[Erp5-report] r16746 - /erp5/trunk/products/ERP5/Document/PackingList.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Oct 1 13:52:15 CEST 2007


Author: romain
Date: Mon Oct  1 13:52:15 2007
New Revision: 16746

URL: http://svn.erp5.org?rev=16746&view=rev
Log:
Calculate container total quantity with python, instead of sql.

Modified:
    erp5/trunk/products/ERP5/Document/PackingList.py

Modified: erp5/trunk/products/ERP5/Document/PackingList.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PackingList.py?rev=16746&r1=16745&r2=16746&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PackingList.py (original)
+++ erp5/trunk/products/ERP5/Document/PackingList.py Mon Oct  1 13:52:15 2007
@@ -104,8 +104,16 @@
       for movement in self.getMovementList():
 
         quantity = movement.getQuantity()
-        # XXX FIXME: script name hardcoded
-        packed_quantity = movement.Movement_getPackedQuantity()
+        query_kw = {
+          'portal_type': self.getPortalContainerLineTypeList(),
+          'movement.explanation_uid': self.getUid(),
+          'movement.resource_uid': movement.getResourceUid(),
+          'movement.variation_text': movement.getVariationText(),
+          'has_cell_content': 0,
+        }
+        container_mvt_list = self.portal_catalog(**query_kw)
+        packed_quantity = sum([x.quantity for x in container_mvt_list \
+                               if x.quantity is not None])
 
         if quantity != packed_quantity:
           return 0




More information about the Erp5-report mailing list