From 404a122f0761bca7f0a1b8f81aaf511c91955851 Mon Sep 17 00:00:00 2001 From: Alexandre Boeglin <alex@nexedi.com> Date: Thu, 4 Oct 2007 17:10:18 +0000 Subject: [PATCH] Check that getCausalityState is available before calling it. For instance, Accounting Trnsaction Lines can be contained in a Accounring Rule Cell of a Invoice Transaction Rule, and none of these provide a causality workflow, but Accounting Transaction Line is also a possible child of a Accounting Transaction in the Accounting Transaction Module. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16830 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../DeliveryMovement_calculateCausalityState.xml | 15 ++++++++++++++- product/ERP5/bootstrap/erp5_core/bt/revision | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/delivery_movement_causality_interaction_workflow/scripts/DeliveryMovement_calculateCausalityState.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/delivery_movement_causality_interaction_workflow/scripts/DeliveryMovement_calculateCausalityState.xml index 172f58ba66..e7751a7afa 100644 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/delivery_movement_causality_interaction_workflow/scripts/DeliveryMovement_calculateCausalityState.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/delivery_movement_causality_interaction_workflow/scripts/DeliveryMovement_calculateCausalityState.xml @@ -71,7 +71,18 @@ <value> <string>delivery_movement = state_change[\'object\']\n \n delivery = delivery_movement.getExplanationValue()\n -if delivery.getCausalityState() != \'draft\':\n +\n +# Check that getCausalityState is available.\n +# For instance, Accounting Trnsaction Lines\n +# can be contained in a Accounring Rule Cell\n +# of a Invoice Transaction Rule, and none of\n +# these provide a causality workflow, but\n +# Accounting Transaction Line is also a\n +# possible child of a Accounting Transaction\n +# in the Accounting Transaction Module\n +\n +if getattr(delivery, \'getCausalityState\', None) is not None and \\\n + delivery.getCausalityState() != \'draft\':\n delivery.calculate()\n </string> </value> </item> @@ -120,6 +131,8 @@ if delivery.getCausalityState() != \'draft\':\n <string>delivery_movement</string> <string>_getattr_</string> <string>delivery</string> + <string>getattr</string> + <string>None</string> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 9301519f58..eb1f49486a 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -483 \ No newline at end of file +500 \ No newline at end of file -- 2.30.9