[Erp5-report] r19987 - /erp5/trunk/products/ERP5/Document/Item.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Mar 18 11:36:20 CET 2008
Author: yusei
Date: Tue Mar 18 11:36:19 2008
New Revision: 19987
URL: http://svn.erp5.org?rev=19987&view=rev
Log:
Implement getRemainingQuantity method.
Modified:
erp5/trunk/products/ERP5/Document/Item.py
Modified: erp5/trunk/products/ERP5/Document/Item.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Item.py?rev=19987&r1=19986&r2=19987&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Item.py (original)
+++ erp5/trunk/products/ERP5/Document/Item.py Tue Mar 18 11:36:19 2008
@@ -102,4 +102,15 @@
local_price = resource.getPrice(self.asContext( context=context, **kw))
return local_price
-
+ security.declareProtected(Permissions.ModifyPortalContent, 'getRemainingQuantity')
+ def getRemainingQuantity(self):
+ """
+ Computes the quantity of an item minus quantity of all sub_items
+ """
+ sub_quantity = 0
+ sub_item_list = [document
+ for document in self.objectValues()
+ if document.isItem()]
+ for sub_item in sub_item_list :
+ sub_quantity += sub_item.getQuantity()
+ return self.getQuantity() - sub_quantity
More information about the Erp5-report
mailing list