From 3dae10a792d49d685debfe52eb7d61b9a6dc93f9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 10 Sep 2019 20:49:13 +0200 Subject: QA: lock/unlock (sites, operations, context records, finds, containers, warehouses) --- archaeological_operations/models.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'archaeological_operations/models.py') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index c2e4e618b..6a25490d7 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -111,7 +111,7 @@ post_delete.connect(post_save_cache, sender=RecordQualityType) class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, - GeoItem, OwnPerms, ValueGetter, ShortMenuItem): + GeoItem, OwnPerms, ValueGetter, MainItem): SLUG = 'site' APP = "archaeological-operations" MODEL = "archaeological-site" @@ -256,6 +256,15 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, 'cached_remains'] DOWN_MODEL_UPDATE = ["context_records"] + QA_LOCK = QuickAction( + url="contextrecord-qa-lock", icon_class="fa fa-lock", + text=_(u"Lock/Unlock"), target="many", + rights=['change_contextrecord', 'change_own_contextrecord'] + ) + QUICK_ACTIONS = [ + QA_LOCK + ] + objects = SiteManager() reference = models.CharField(_("Reference"), max_length=200, unique=True) @@ -870,9 +879,14 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem, QA_EDIT = QuickAction( url="operation-qa-bulk-update", icon_class="fa fa-pencil", text=_(u"Bulk update"), target="many", - rights=['change_operation', 'change_own_operation']) + ) + QA_LOCK = QuickAction( + url="operation-qa-lock", icon_class="fa fa-lock", + text=_(u"Lock/Unlock"), target="many", + rights=['change_operation', 'change_own_operation'] + ) QUICK_ACTIONS = [ - QA_EDIT + QA_EDIT, QA_LOCK ] UP_MODEL_QUERY = { @@ -1284,7 +1298,7 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem, actions = super(Operation, self).get_extra_actions(request) can_add_cr = self.can_do(request, 'add_contextrecord') - if can_add_cr: + if can_add_cr and not self.locked: actions += [ (reverse('operation-qa-contextrecord', args=[self.pk]), _("Add context record"), "fa fa-plus", -- cgit v1.2.3