Skip to content

Commit 17687ca

Browse files
authored
Merge pull request #384 from maykinmedia/fix/383-zaak-url-not-populated
[#383] Fix _zaak_url not populated
2 parents 2ea3790 + fb24d7f commit 17687ca

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

backend/src/openarchiefbeheer/destruction/models.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ def set_status(self, status: str) -> None:
126126

127127
def add_items(self, zaken: Iterable["Zaak"]) -> list["DestructionListItem"]:
128128
return DestructionListItem.objects.bulk_create(
129-
[DestructionListItem(destruction_list=self, zaak=zaak) for zaak in zaken]
129+
[
130+
DestructionListItem(
131+
destruction_list=self, zaak=zaak, _zaak_url=zaak.url
132+
)
133+
for zaak in zaken
134+
]
130135
)
131136

132137
def get_author(self) -> "DestructionListAssignee":

backend/src/openarchiefbeheer/destruction/tests/test_endpoints.py

+6
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ def test_create_destruction_list(self):
114114
self.assertEqual(
115115
items[1].zaak.url, "http://localhost:8003/zaken/api/v1/zaken/222-222-222"
116116
)
117+
self.assertEqual(
118+
items[0]._zaak_url, "http://localhost:8003/zaken/api/v1/zaken/111-111-111"
119+
)
120+
self.assertEqual(
121+
items[1]._zaak_url, "http://localhost:8003/zaken/api/v1/zaken/222-222-222"
122+
)
117123

118124
self.assertEqual(destruction_list.author, record_manager)
119125

0 commit comments

Comments
 (0)