diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-05-20 11:23:10 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:21:00 +0100 |
commit | 3ff82007369b115406c2f2effbdfb13188167bb7 (patch) | |
tree | d5601f32c841063bcd93741d3516772c0ebe4bad /archaeological_operations | |
parent | 7659a92661450c331c79fbe59dee5b75434ee02d (diff) | |
download | Ishtar-3ff82007369b115406c2f2effbdfb13188167bb7.tar.bz2 Ishtar-3ff82007369b115406c2f2effbdfb13188167bb7.zip |
Parcels: remove from operation wizard - improve display
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/models.py | 34 | ||||
-rw-r--r-- | archaeological_operations/views.py | 12 |
2 files changed, 25 insertions, 21 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 90a4043b6..205cac550 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -1775,28 +1775,25 @@ class Operation( is_locked = self.is_locked(request.user) can_edit_operation = self.can_do(request, "change_operation") - if can_edit_operation: - actions += [ - ( - reverse("operation-qa-duplicate", args=[self.pk]), - _("Duplicate"), - "fa fa-clone", - "", - "", - True, - ), + if can_edit_operation and not is_locked: + actions = [ ( reverse("operation-parcels-modify", args=[self.pk]), - _("Modify Parcels"), + _("Modify parcels"), "fa fa-pencil", _("parcels"), "", True, ), - ] + ] + actions can_add_cr = self.can_do(request, "add_contextrecord") if can_add_cr and not is_locked: - actions += [ + start = actions + end = [] + if actions[-1] and actions[-1][0].startswith("/document/create"): + start = actions[:-1] + end = [actions[-1]] + actions = start + [ ( reverse("operation-qa-contextrecord", args=[self.pk]), _("Add context record"), @@ -1805,6 +1802,17 @@ class Operation( "", True, ), + ] + end + if can_edit_operation: + actions += [ + ( + reverse("operation-qa-duplicate", args=[self.pk]), + _("Duplicate"), + "fa fa-clone", + "", + "", + True, + ), ] return actions diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 6d34163d4..468a864b8 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -216,8 +216,6 @@ wizard_steps = [ ("preventivediag-operation_creation", forms.OperationFormPreventiveDiag), ("townsgeneral-operation_creation", forms.TownFormset), ("towns-operation_creation", forms.SelectedTownFormset), - ("parcelsgeneral-operation_creation", forms.SelectedParcelGeneralFormSet), - ("parcels-operation_creation", forms.SelectedParcelFormSet), ("remains-operation_creation", forms.RemainForm), ("periods-operation_creation", forms.PeriodForm), ("relations-operation_creation", forms.RecordRelationsFormSet), @@ -273,10 +271,10 @@ ope_crea_condition_dict = { ), "parcelsgeneral-operation_creation": wizards.has_associated_file( "filechoice-operation_creation", negate=True - ), + ), # TODO: AFAC "parcels-operation_creation": wizards.has_associated_file( "filechoice-operation_creation" - ), + ), # TODO: AFAC } operation_creation_wizard = wizards.OperationWizard.as_view( @@ -296,8 +294,6 @@ operation_modif_wizard_steps = [ ("preventivediag-operation_modification", forms.OperationFormPreventiveDiag), ("towns-operation_modification", forms.SelectedTownFormset), ("townsgeneral-operation_modification", forms.TownFormset), - ("parcels-operation_modification", forms.SelectedParcelFormSet), - ("parcelsgeneral-operation_modification", forms.SelectedParcelGeneralFormSet), ("remains-operation_modification", forms.RemainForm), ("periods-operation_modification", forms.PeriodForm), ("relations-operation_modification", forms.RecordRelationsFormSet), @@ -336,10 +332,10 @@ ope_modif_condition_dict = { ), "parcelsgeneral-operation_modification": wizards.has_associated_file( "general-operation_modification", negate=True - ), + ), # TODO: AFAC "parcels-operation_modification": wizards.has_associated_file( "general-operation_modification" - ), + ), # TODO: AFAC } operation_modification_wizard = wizards.OperationModificationWizard.as_view( |