File tree 4 files changed +89
-0
lines changed
backend/src/openarchiefbeheer/destruction
4 files changed +89
-0
lines changed Original file line number Diff line number Diff line change 18
18
from openarchiefbeheer .zaken .models import Zaak
19
19
20
20
from ..constants import (
21
+ DestructionListItemAction ,
21
22
InternalStatus ,
22
23
ListItemStatus ,
23
24
ListRole ,
24
25
ListStatus ,
25
26
ReviewDecisionChoices ,
27
+ ZaakActionType ,
26
28
)
27
29
from ..models import (
28
30
DestructionList ,
@@ -502,11 +504,53 @@ class Meta:
502
504
"pk" ,
503
505
"review_item" ,
504
506
"action_item" ,
507
+ "action_zaak_type" ,
505
508
"action_zaak" ,
506
509
"created" ,
507
510
"comment" ,
508
511
)
509
512
513
+ def validate (self , attrs : dict ) -> dict :
514
+ action_zaak = attrs .get ("action_zaak" , {})
515
+ if attrs ["action_item" ] == DestructionListItemAction .keep and action_zaak :
516
+ raise ValidationError (
517
+ {
518
+ "action_zaak" : _ (
519
+ "The case cannot be changed if it is kept in the destruction list."
520
+ )
521
+ }
522
+ )
523
+
524
+ zaak_action_type = attrs .get ("action_zaak_type" )
525
+ selectielijstklasse = action_zaak .get ("selectielijstklasse" )
526
+ if (
527
+ attrs ["action_item" ] == DestructionListItemAction .remove
528
+ and zaak_action_type == ZaakActionType .bewaartermijn
529
+ and selectielijstklasse
530
+ ):
531
+ raise ValidationError (
532
+ {
533
+ "action_zaak_type" : _ (
534
+ "The selectielijstklasse cannot be changed if the case action type is 'bewaartermijn'."
535
+ )
536
+ }
537
+ )
538
+
539
+ if (
540
+ attrs ["action_item" ] == DestructionListItemAction .remove
541
+ and zaak_action_type == ZaakActionType .selectielijstklasse_and_bewaartermijn
542
+ and not selectielijstklasse
543
+ ):
544
+ raise ValidationError (
545
+ {
546
+ "selectielijstklasse" : _ (
547
+ "The selectielijstklasse is required for action type is 'selectielijstklasse_and_bewaartermijn'."
548
+ )
549
+ }
550
+ )
551
+
552
+ return attrs
553
+
510
554
511
555
class ReviewResponseSerializer (serializers .ModelSerializer ):
512
556
items_responses = ReviewItemResponseSerializer (many = True )
Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ class DestructionListItemAction(models.TextChoices):
33
33
remove = "remove" , _ ("remove" )
34
34
35
35
36
+ class ZaakActionType (models .TextChoices ):
37
+ selectielijstklasse_and_bewaartermijn = "selectielijstklasse_and_bewaartermijn" , _ (
38
+ "selectielijstklasse and bewaartermijn"
39
+ )
40
+ bewaartermijn = "bewaartermijn" , _ ("bewaartermijn" )
41
+
42
+
36
43
class InternalStatus (models .TextChoices ):
37
44
new = "new" , _ ("new" )
38
45
queued = "queued" , _ ("queued" )
Original file line number Diff line number Diff line change
1
+ # Generated by Django 4.2.15 on 2024-09-23 13:12
2
+
3
+ from django .db import migrations , models
4
+
5
+
6
+ class Migration (migrations .Migration ):
7
+
8
+ dependencies = [
9
+ ("destruction" , "0021_destructionlist_planned_destruction_date" ),
10
+ ]
11
+
12
+ operations = [
13
+ migrations .AddField (
14
+ model_name = "reviewitemresponse" ,
15
+ name = "action_zaak_type" ,
16
+ field = models .CharField (
17
+ blank = True ,
18
+ choices = [
19
+ (
20
+ "selectielijstklasse_and_bewaartermijn" ,
21
+ "selectielijstklasse and bewaartermijn" ,
22
+ ),
23
+ ("bewaartermijn" , "bewaartermijn" ),
24
+ ],
25
+ help_text = "What type of change to do on the case. " ,
26
+ max_length = 80 ,
27
+ verbose_name = "action zaak type" ,
28
+ ),
29
+ ),
30
+ ]
Original file line number Diff line number Diff line change 24
24
ListRole ,
25
25
ListStatus ,
26
26
ReviewDecisionChoices ,
27
+ ZaakActionType ,
27
28
)
28
29
from .exceptions import ZaakArchiefactiedatumInFuture , ZaakNotFound
29
30
@@ -468,6 +469,13 @@ class ReviewItemResponse(models.Model):
468
469
choices = DestructionListItemAction .choices ,
469
470
max_length = 80 ,
470
471
)
472
+ action_zaak_type = models .CharField (
473
+ _ ("action zaak type" ),
474
+ choices = ZaakActionType .choices ,
475
+ max_length = 80 ,
476
+ help_text = _ ("What type of change to do on the case. " ),
477
+ blank = True ,
478
+ )
471
479
action_zaak = models .JSONField (
472
480
_ ("action case" ),
473
481
blank = True ,
You can’t perform that action at this time.
0 commit comments