From 1dc57b9319afa0589ee35c5161e4bf253de83b7e Mon Sep 17 00:00:00 2001 From: bart-maykin Date: Thu, 14 Nov 2024 12:40:55 +0100 Subject: [PATCH] :card_file_box: [#76] added documenthandeling fields directly in the document model. This is because we only allow one action as per now, and migrating this in the future to its own model when we allow multiple instances is very easy to do. Also for now we can just use the publications 'verantwoordelijke' field as the 'wasAssciatedWith' because for now these two won't differ from eachother. --- .../publications/constants.py | 6 +++++ .../0011_document_soort_handeling.py | 26 +++++++++++++++++++ src/woo_publications/publications/models.py | 9 ++++++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/woo_publications/publications/migrations/0011_document_soort_handeling.py diff --git a/src/woo_publications/publications/constants.py b/src/woo_publications/publications/constants.py index b9e1edcf..868e6e5a 100644 --- a/src/woo_publications/publications/constants.py +++ b/src/woo_publications/publications/constants.py @@ -6,3 +6,9 @@ class PublicationStatusOptions(models.TextChoices): published = "gepubliceerd", _("Published") concept = "concept", _("Concept") revoked = "ingetrokken", _("Revoked") + + +class DocumentActionTypeOptions(models.TextChoices): + signed = "ondertekening", _("Signed") + received = "ontvangst", _("Received") + declared = "vaststelling", _("Declared") diff --git a/src/woo_publications/publications/migrations/0011_document_soort_handeling.py b/src/woo_publications/publications/migrations/0011_document_soort_handeling.py new file mode 100644 index 00000000..7e97064c --- /dev/null +++ b/src/woo_publications/publications/migrations/0011_document_soort_handeling.py @@ -0,0 +1,26 @@ +# Generated by Django 4.2.16 on 2024-11-14 11:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("publications", "0010_alter_document_identifier"), + ] + + operations = [ + migrations.AddField( + model_name="document", + name="soort_handeling", + field=models.CharField( + choices=[ + ("ondertekening", "Signed"), + ("ontvangst", "Received"), + ("vaststelling", "Declared"), + ], + default="vaststelling", + verbose_name="action type", + ), + ), + ] diff --git a/src/woo_publications/publications/models.py b/src/woo_publications/publications/models.py index 7fa7df51..08b6bf5b 100644 --- a/src/woo_publications/publications/models.py +++ b/src/woo_publications/publications/models.py @@ -24,7 +24,7 @@ from woo_publications.logging.typing import ActingUser from woo_publications.metadata.models import InformationCategory -from .constants import PublicationStatusOptions +from .constants import DocumentActionTypeOptions, PublicationStatusOptions # when the document isn't specified both the service and uuid needs to be unset _DOCUMENT_NOT_SET = models.Q(document_service=None, document_uuid=None) @@ -264,6 +264,13 @@ class Document(models.Model): ), ) + # documenthandeling fields + soort_handeling = models.CharField( + verbose_name=_("action type"), + choices=DocumentActionTypeOptions.choices, + default=DocumentActionTypeOptions.declared, + ) + # Documents API integration document_service = models.ForeignKey( "zgw_consumers.Service",