From 0c100680eb4d2ffb46a1539fb00282a7aafb79a4 Mon Sep 17 00:00:00 2001 From: Jean-Paul Smets <jp@nexedi.com> Date: Sun, 8 Feb 2004 17:22:39 +0000 Subject: [PATCH] addPermission changed to addPortalContent fixed Solanes typo add inventory acquisition method git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@410 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/InventoryCell.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/product/ERP5/Document/InventoryCell.py b/product/ERP5/Document/InventoryCell.py index 96261dd14b..7f6a092352 100755 --- a/product/ERP5/Document/InventoryCell.py +++ b/product/ERP5/Document/InventoryCell.py @@ -1,7 +1,7 @@ ############################################################################## # # Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved. -# Jean-Paul Smets-Solane <jp@nexedi.com> +# Jean-Paul Smets-Solanes <jp@nexedi.com> # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsability of assessing all potential @@ -44,7 +44,7 @@ class InventoryCell(DeliveryCell): meta_type = 'ERP5 Inventory Cell' portal_type = 'Inventory Cell' - add_permission = Permissions.AddERP5Content + add_permission = Permissions.AddPortalContent isPortalContent = 1 isRADContent = 1 isMovement = 1 @@ -196,6 +196,21 @@ Une ligne tarifaire.""" return self.getInventory() - current_inventory return self.getInventory() + security.declareProtected( Permissions.AccessContentsInformation, 'getInventory' ) + def getInventory(self): + """ + Returns the quantity if defined on the cell + or acquire it + """ + # Call a script on the context + if 'inventory' in self.getMappedValuePropertyList([]): + if getattr(aq_base(self), 'inventory', None) is not None: + return getattr(self, 'inventory') + else: + return self.aq_parent.getProperty('inventory') + else: + return None # return None + def _setItemIdList(self, value): """ Computes total_quantity of all given items and stores this total_quantity -- 2.30.9