Commit 6efe0d17 authored by Łukasz Nowak's avatar Łukasz Nowak

- 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
parent e2ac3668
...@@ -238,10 +238,9 @@ class BPMRule(Predicate, XMLObject): ...@@ -238,10 +238,9 @@ class BPMRule(Predicate, XMLObject):
return input_movement_and_path_list return input_movement_and_path_list
def _getCompensatedMovementList(self, applied_rule, **kw): 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 XXX For now, this implementation is too simple. It could be improved by
using MovementGroups using MovementGroups
...@@ -285,10 +284,9 @@ class BPMRule(Predicate, XMLObject): ...@@ -285,10 +284,9 @@ class BPMRule(Predicate, XMLObject):
prop_dict['quantity'] = movement.getQuantity() + \ prop_dict['quantity'] = movement.getQuantity() + \
q_diff q_diff
break break
# no modifiable movement was found, need to create one
else: else:
prevision['quantity'] = q_diff # no modifiable movement was found, need to compensate by quantity
add_list.append(prevision) raise NotImplementedError('Need to generate quantity compensation')
# Check the date # Check the date
for movement in p_matched_list: for movement in p_matched_list:
...@@ -326,9 +324,8 @@ class BPMRule(Predicate, XMLObject): ...@@ -326,9 +324,8 @@ class BPMRule(Predicate, XMLObject):
else: else:
# movement not modifiable, we can decide to create a compensation # movement not modifiable, we can decide to create a compensation
# with negative quantity # with negative quantity
raise NotImplementedError( raise NotImplementedError("Tried to delete immutable movement %s" % \
"Can not create a compensation movement for %s" % \ movement.getRelativeUrl())
movement.getRelativeUrl())
return (add_list, modify_dict, delete_list) return (add_list, modify_dict, delete_list)
def _getExpandablePropertyDict(self, applied_rule, movement, business_path, def _getExpandablePropertyDict(self, applied_rule, movement, business_path,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment