Commit d4b83fa7 authored by Rafael Monnerat's avatar Rafael Monnerat

The invoicing rule expand was over-wrinting with old values the properties

in the simulation movements.

This fix one part of testInvoice, but still they fail because the floating Problem.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10150 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5df48fa3
...@@ -138,28 +138,31 @@ class InvoicingRule(Rule): ...@@ -138,28 +138,31 @@ class InvoicingRule(Rule):
modify, remove) modify, remove)
- add/modify/remove child movements to match prevision - add/modify/remove child movements to match prevision
""" """
add_list, modify_dict, \ parent_movement = applied_rule.getParentValue()
delete_list = self._getCompensatedMovementList(applied_rule, **kw) if parent_movement is not None:
if not parent_movement.isFrozen():
for movement_id in delete_list: add_list, modify_dict, \
applied_rule._delObject(movement_id) delete_list = self._getCompensatedMovementList(applied_rule, **kw)
for movement_id in delete_list:
applied_rule._delObject(movement_id)
for movement, prop_dict in modify_dict.items(): for movement, prop_dict in modify_dict.items():
#XXX ignore start_date and stop_date if the difference is smaller than a #XXX ignore start_date and stop_date if the difference is smaller than a
# rule defined value # rule defined value
for prop in ('start_date', 'stop_date'): for prop in ('start_date', 'stop_date'):
if prop in prop_dict.keys(): if prop in prop_dict.keys():
prop_dict.pop(prop) prop_dict.pop(prop)
applied_rule[movement].edit(**prop_dict) applied_rule[movement].edit(**prop_dict)
for movement_dict in add_list: for movement_dict in add_list:
if 'id' in movement_dict.keys(): if 'id' in movement_dict.keys():
mvmt_id = applied_rule._get_id(movement_dict.pop('id')) mvmt_id = applied_rule._get_id(movement_dict.pop('id'))
new_mvmt = applied_rule.newContent(id=mvmt_id, new_mvmt = applied_rule.newContent(id=mvmt_id,
portal_type=self.movement_type) portal_type=self.movement_type)
else: else:
new_mvmt = applied_rule.newContent(portal_type=self.movement_type) new_mvmt = applied_rule.newContent(portal_type=self.movement_type)
new_mvmt.edit(**movement_dict) new_mvmt.edit(**movement_dict)
# Pass to base class # Pass to base class
Rule.expand(self, applied_rule, force=force, **kw) Rule.expand(self, applied_rule, force=force, **kw)
......
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