diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-02-22 13:35:49 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-02-22 13:35:49 +0100 |
commit | 8416c63507d00f1aa6ec2048d403e4f99176585e (patch) | |
tree | b19a8c348c3de810612e75c655491a586a3cefc7 | |
parent | 3331e1e6a30f769de5591b1ac1616184e41a3fa9 (diff) | |
download | Ishtar-8416c63507d00f1aa6ec2048d403e4f99176585e.tar.bz2 Ishtar-8416c63507d00f1aa6ec2048d403e4f99176585e.zip |
File: filter plan action when preventive_operator is activated in profile
-rw-r--r-- | CHANGES.md | 1 | ||||
-rw-r--r-- | archaeological_files/models.py | 8 | ||||
-rw-r--r-- | ishtar_common/admin.py | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/CHANGES.md b/CHANGES.md index 32630daca..5202eb3fe 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ Ishtar changelog ### Bug fixes ### - find form: remove TAQ/TPQ check - fix treatment and file treatment sheet display (bad QR code link) +- File: filter plan action when preventive_operator is activated in profile v4.0.42 - 2023-01-25 -------------------- diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 529e3e0e6..d81433a25 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -29,7 +29,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator from django.db.models import Q, Count, Sum, Max from django.db.models.signals import post_save, m2m_changed, post_delete from django.urls import reverse -from ishtar_common.utils import ugettext_lazy as _, pgettext_lazy +from ishtar_common.utils import ugettext_lazy as _, pgettext_lazy, get_current_profile from ishtar_common.utils import ( cached_label_changed, @@ -1241,7 +1241,8 @@ class File( True, ), ] - if self.can_do(request, "add_administrativeact"): + profile = get_current_profile() + if profile.preventive_operator: actions += [ ( reverse("file-edit-preventive", args=[self.pk]), @@ -1251,6 +1252,9 @@ class File( "", False, ), + ] + if self.can_do(request, "add_administrativeact"): + actions += [ ( reverse("file-add-adminact", args=[self.pk]), _("Add associated administrative act"), diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py index 6429210d0..4937d75b6 100644 --- a/ishtar_common/admin.py +++ b/ishtar_common/admin.py @@ -529,6 +529,7 @@ class IshtarSiteProfileAdmin(admin.ModelAdmin): "warehouse", "preservation", "mapping", + "preventive_operator", "underwater", ), }), |