diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-08 13:18:44 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-08 13:53:26 +0100 |
commit | 4135c16fc28925ba8a42006d1e2849829b7e4ddd (patch) | |
tree | 5ceaff0b2e85bb35944a697fff2d3d2e76e9546d /archaeological_operations/models.py | |
parent | 5ec494564251e27e3f802e6c1aec3c6aa1890488 (diff) | |
download | Ishtar-4135c16fc28925ba8a42006d1e2849829b7e4ddd.tar.bz2 Ishtar-4135c16fc28925ba8a42006d1e2849829b7e4ddd.zip |
Site: quick add operation action (refs #4450)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 091e1e60c..ee2023f5c 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -470,6 +470,14 @@ class ArchaeologicalSite( QA_EDIT, QA_LOCK, QuickAction( + url="site-add-operation", + icon_class="fa fa-plus", + text=_("Create associated operation"), + target="many", + rights=["change_operation"], + is_popup=False + ), + QuickAction( url="site-qa-duplicate", icon_class="fa fa-clone", text=_("Duplicate"), @@ -620,10 +628,22 @@ class ArchaeologicalSite( actions.append(self.get_add_geo_action()) can_create_operation = self.can_do(request, "change_operation") + if can_create_operation and not self.operations.count(): + actions.append( + ( + reverse("site-add-operation", args=[self.pk]), + _("Create an operation associated to this site"), + "fa fa-plus", + _("ope."), + "", + False + ) + ) + if can_create_operation and self.operations.count(): actions.append( ( - reverse("site-qa-top-operation", args=[self.pk]), + reverse("site-add-top-operation", args=[self.pk]), _("Create a cluster operation for site associated to many operations"), "fa fa-plus", _("top ope."), |