From 23208f41321a1b4c49ad1d8849cd87c57e656d00 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Tue, 25 Mar 2008 12:33:52 +0000 Subject: [PATCH] add a new movement group wich allows to set the causality on lines and cells git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20102 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/MovementGroup.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/product/ERP5/MovementGroup.py b/product/ERP5/MovementGroup.py index 9327595393..29cb770bd8 100644 --- a/product/ERP5/MovementGroup.py +++ b/product/ERP5/MovementGroup.py @@ -259,6 +259,28 @@ class OrderMovementGroup(RootMovementGroup): allow_class(OrderMovementGroup) +class DefineMovementCausalityMovementGroup(RootMovementGroup): + """ TODO: docstring """ + + def addCausalityToEdit(self, movement): + order_movement = movement.getOrderValue() + if order_movement is not None: + causality = self.getGroupEditDict().get('causality', []) + order_movement_url = order_movement.getRelativeUrl() + if order_movement_url not in causality: + causality.append(order_movement_url) + self.setGroupEdit(causality=causality) + + def __init__(self, movement, **kw): + RootMovementGroup.__init__(self, movement=movement, **kw) + self.addCausalityToEdit(movement) + + def test(self, movement): + self.addCausalityToEdit(movement) + return 1 + +allow_class(DefineMovementCausalityMovementGroup) + class CausalityMovementGroup(RootMovementGroup): """ TODO: docstring """ -- 2.30.9