From 6efe0d17e405297900e274a030b34b52d5321ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Mon, 3 Aug 2009 16:09:40 +0000 Subject: [PATCH] - properly raise in case for compensation - fix docstring a little git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28257 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/BPMRule.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/product/ERP5/Document/BPMRule.py b/product/ERP5/Document/BPMRule.py index 4c1e01cbc4..97329ef77e 100644 --- a/product/ERP5/Document/BPMRule.py +++ b/product/ERP5/Document/BPMRule.py @@ -238,10 +238,9 @@ class BPMRule(Predicate, XMLObject): return input_movement_and_path_list def _getCompensatedMovementList(self, applied_rule, **kw): - """ - Compute the difference between prevision and existing movements + """Compute the difference between prevision and existing movements - immutable movements need compensation, mutables needs to be modified + Immutable movements need compensation, mutable ones needs to be modified XXX For now, this implementation is too simple. It could be improved by using MovementGroups @@ -285,10 +284,9 @@ class BPMRule(Predicate, XMLObject): prop_dict['quantity'] = movement.getQuantity() + \ q_diff break - # no modifiable movement was found, need to create one else: - prevision['quantity'] = q_diff - add_list.append(prevision) + # no modifiable movement was found, need to compensate by quantity + raise NotImplementedError('Need to generate quantity compensation') # Check the date for movement in p_matched_list: @@ -326,9 +324,8 @@ class BPMRule(Predicate, XMLObject): else: # movement not modifiable, we can decide to create a compensation # with negative quantity - raise NotImplementedError( - "Can not create a compensation movement for %s" % \ - movement.getRelativeUrl()) + raise NotImplementedError("Tried to delete immutable movement %s" % \ + movement.getRelativeUrl()) return (add_list, modify_dict, delete_list) def _getExpandablePropertyDict(self, applied_rule, movement, business_path, -- 2.30.9