diff options
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 34 |
1 files changed, 21 insertions, 13 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 |