Skip to content

Commit 1a967a0

Browse files
committed
[#2825] Venray/Rx.mission - use zaak.omschrijving if available instead of zaaktype.omschrijving
1 parent 323eb21 commit 1a967a0

File tree

5 files changed

+84
-3
lines changed

5 files changed

+84
-3
lines changed

src/open_inwoner/openzaak/admin.py

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class OpenZaakConfigAdmin(SingletonModelAdmin):
6969
"fields": (
7070
"enable_categories_filtering_with_zaken",
7171
"zaken_filter_enabled",
72+
"use_zaak_omschrijving_as_title",
7273
),
7374
},
7475
),

src/open_inwoner/openzaak/api_models.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,28 @@ def status_text(self) -> str:
9191

9292
return _status_text
9393

94+
@property
95+
def description(self) -> str:
96+
from open_inwoner.openzaak.models import OpenZaakConfig
97+
98+
zaak_config = OpenZaakConfig.get_solo()
99+
100+
description = self.zaaktype.omschrijving
101+
if zaak_config.use_zaak_omschrijving_as_title and self.omschrijving:
102+
description = self.omschrijving
103+
104+
return description
105+
94106
def process_data(self) -> dict:
95107
"""
96108
Prepare data for template
97109
"""
98-
99110
return {
100111
"identification": self.identification,
101112
"uuid": str(self.uuid),
102113
"start_date": self.startdatum,
103114
"end_date": getattr(self, "einddatum", None),
104-
"description": self.zaaktype.omschrijving,
115+
"description": self.description,
105116
"current_status": self.status_text,
106117
"zaaktype_config": getattr(self, "zaaktype_config", None),
107118
"statustype_config": getattr(self, "statustype_config", None),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generated by Django 4.2.16 on 2024-10-21 13:41
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("openzaak", "0055_openzaakconfig_zaken_filter_enabled"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="openzaakconfig",
15+
name="use_zaak_omschrijving_as_title",
16+
field=models.BooleanField(
17+
default=False,
18+
help_text="If enabled, we use zaak.omschrijving for the title of the cases, and use zaaktype.omschrijving as a fallback in case it is not filled in. If not enabled, we ignore zaak.omschrijving and always use zaaktype.omschrijving.",
19+
verbose_name="Make use of zaak.omschrijving for the title of the cases instead of zaaktype.omschrijving (eSuite)",
20+
),
21+
),
22+
]

src/open_inwoner/openzaak/models.py

+13
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,19 @@ def form_service(self, service):
412412
default=False,
413413
)
414414

415+
use_zaak_omschrijving_as_title = models.BooleanField(
416+
verbose_name=_(
417+
"Make use of zaak.omschrijving for the title of the cases instead of "
418+
"zaaktype.omschrijving (eSuite)"
419+
),
420+
help_text=_(
421+
"If enabled, we use zaak.omschrijving for the title of the cases, and use "
422+
"zaaktype.omschrijving as a fallback in case it is not filled in. "
423+
"If not enabled, we ignore zaak.omschrijving and always use zaaktype.omschrijving."
424+
),
425+
default=False,
426+
)
427+
415428
title_text = models.TextField(
416429
verbose_name=_("Title text"),
417430
help_text=_(

src/open_inwoner/openzaak/tests/test_api_models.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
from zgw_consumers.api_models.base import factory
55

6-
from open_inwoner.openzaak.api_models import Zaak
6+
from open_inwoner.openzaak.api_models import Zaak, ZaakType
7+
from open_inwoner.openzaak.models import OpenZaakConfig
78

89

910
class ZaakAPIModelTest(TestCase):
@@ -90,3 +91,36 @@ def test_status_text_default(self):
9091
case = factory(Zaak, data=self.zaak_data)
9192

9293
self.assertEqual(case.status_text, _("No data available"))
94+
95+
def test_zaak_omschrijving(self):
96+
zaaktype = factory(
97+
ZaakType,
98+
data={
99+
"url": "https://example.com",
100+
"identificatie": "VTH001",
101+
"catalogus": "https://example.com",
102+
"vertrouwelijkheidaanduiding": "openbaar",
103+
"doel": "-",
104+
"aanleiding": "-",
105+
"indicatie_intern_of_extern": "extern",
106+
"handeling_initiator": "Aanvragen",
107+
"onderwerp": "VTH",
108+
"handeling_behandelaar": "Behandelen",
109+
"statustypen": [],
110+
"resultaattypen": [],
111+
"informatieobjecttypen": [],
112+
"omschrijving": "Vergunning",
113+
},
114+
)
115+
self.zaak_data["zaaktype"] = zaaktype
116+
self.zaak_data["omschrijving"] = "Vergunning voor Joeri"
117+
118+
case = factory(Zaak, data=self.zaak_data)
119+
120+
self.assertEqual(case.description, "Vergunning")
121+
122+
zaak_config = OpenZaakConfig.get_solo()
123+
zaak_config.use_zaak_omschrijving_as_title = True
124+
zaak_config.save()
125+
126+
self.assertEqual(case.description, "Vergunning voor Joeri")

0 commit comments

Comments
 (0)