summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index d9112b5e7..42b4c479a 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -5633,8 +5633,13 @@ class Document(BaseHistorizedItem, QRCodeItem, OwnPerms, ImageModel,
QuickAction(
url="document-qa-duplicate", icon_class="fa fa-clone",
text=_("Duplicate"), target="one",
- rights=['change_document',
- 'change_own_document']),
+ rights=['change_document', 'change_own_document']),
+ QuickAction(
+ url="document-qa-packaging", icon_class="fa fa-gift",
+ text=_("Packaging"), target="many",
+ rights=['change_document', 'change_own_document'],
+ module='warehouse'
+ ),
]
SERIALIZATION_FILES = ["image", "thumbnail", "associated_file"]
@@ -5795,11 +5800,18 @@ class Document(BaseHistorizedItem, QRCodeItem, OwnPerms, ImageModel,
# is_locked = self.is_locked(request.user)
can_edit_document = self.can_do(request, 'change_document')
- if can_edit_document:
- actions += [
- (reverse("document-qa-duplicate", args=[self.pk]),
- _("Duplicate"), "fa fa-clone", "", "", True),
- ]
+ if not can_edit_document:
+ return actions
+ actions += [
+ (reverse("document-qa-duplicate", args=[self.pk]),
+ _("Duplicate"), "fa fa-clone", "", "", True),
+ ]
+ if get_current_profile().warehouse:
+ actions.append(
+ (reverse("document-qa-packaging", args=[self.pk]),
+ _("Packaging"),
+ "fa fa-gift", "", "", True)
+ )
return actions
@property