From a33d907359d938021fedd8564aed7cf31b432fad Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Tue, 30 Mar 2010 14:01:43 +0000 Subject: [PATCH] Fix activity dependency to update container_state 2 tests in testTradeModelLine were broken since [34190] because container_interaction_workflow relied on the fact that causality_interaction_workflow reindexed the delivery. PackingList.isPacked only requires that container lines/cells are indexed so the calculatePacking activity now depends on recursive reindexation of the container (instead of the delivery). git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34210 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../scripts/DeliveryMovement_calculatePacking.xml | 14 +++++++++++--- bt5/erp5_trade/bt/revision | 2 +- product/ERP5/Document/Container.py | 8 ++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/container_interaction_workflow/scripts/DeliveryMovement_calculatePacking.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/container_interaction_workflow/scripts/DeliveryMovement_calculatePacking.xml index f081013b2c..2b1b6b5988 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/container_interaction_workflow/scripts/DeliveryMovement_calculatePacking.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/container_interaction_workflow/scripts/DeliveryMovement_calculatePacking.xml @@ -53,10 +53,15 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>delivery = state_change[\'object\'].getExplanationValue()\n + <value> <string>object = state_change[\'object\']\n +delivery = object.getExplanationValue()\n \n if getattr(delivery, \'calculatePacking\', None) is not None:\n - path_and_method_id = (delivery.getPath(), (\'immediateReindexObject\',\'recursiveImmediateReindexObject\'))\n + try:\n + container = object.getContainerValue()\n + path_and_method_id = container.getPath(), \'recursiveImmediateReindexObject\'\n + except AttributeError:\n + path_and_method_id = None\n delivery.activate(after_path_and_method_id=path_and_method_id).calculatePacking()\n </string> </value> </item> @@ -95,12 +100,15 @@ if getattr(delivery, \'calculatePacking\', None) is not None:\n <value> <tuple> <string>state_change</string> - <string>_getattr_</string> <string>_getitem_</string> + <string>object</string> + <string>_getattr_</string> <string>delivery</string> <string>getattr</string> <string>None</string> + <string>container</string> <string>path_and_method_id</string> + <string>AttributeError</string> </tuple> </value> </item> diff --git a/bt5/erp5_trade/bt/revision b/bt5/erp5_trade/bt/revision index cd6be3717d..3cdc988178 100644 --- a/bt5/erp5_trade/bt/revision +++ b/bt5/erp5_trade/bt/revision @@ -1 +1 @@ -888 \ No newline at end of file +889 \ No newline at end of file diff --git a/product/ERP5/Document/Container.py b/product/ERP5/Document/Container.py index 37e78d4f6a..3d80c2712b 100644 --- a/product/ERP5/Document/Container.py +++ b/product/ERP5/Document/Container.py @@ -74,6 +74,14 @@ class Container(Movement, XMLObject): , PropertySheet.SortIndex ) + def reindexObject(self, *args, **kw): + """Reindex container and children + + Children must be reindexed because PackingList.isPacked use the catalog + to find them. + """ + self.recursiveReindexObject(*args, **kw) + security.declareProtected(Permissions.AccessContentsInformation, 'getQuantity') def getQuantity(self, default=1.0): -- 2.30.9