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):
modify, remove)
- add/modify/remove child movements to match prevision
"""
add_list, modify_dict, \
delete_list = self._getCompensatedMovementList(applied_rule, **kw)
for movement_id in delete_list:
applied_rule._delObject(movement_id)
parent_movement = applied_rule.getParentValue()
if parent_movement is not None:
if not parent_movement.isFrozen():
add_list, modify_dict, \
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():
#XXX ignore start_date and stop_date if the difference is smaller than a
# rule defined value
for prop in ('start_date', 'stop_date'):
if prop in prop_dict.keys():
prop_dict.pop(prop)
applied_rule[movement].edit(**prop_dict)
for movement_dict in add_list:
if 'id' in movement_dict.keys():
mvmt_id = applied_rule._get_id(movement_dict.pop('id'))
new_mvmt = applied_rule.newContent(id=mvmt_id,
portal_type=self.movement_type)
else:
new_mvmt = applied_rule.newContent(portal_type=self.movement_type)
new_mvmt.edit(**movement_dict)
for movement, prop_dict in modify_dict.items():
#XXX ignore start_date and stop_date if the difference is smaller than a
# rule defined value
for prop in ('start_date', 'stop_date'):
if prop in prop_dict.keys():
prop_dict.pop(prop)
applied_rule[movement].edit(**prop_dict)
for movement_dict in add_list:
if 'id' in movement_dict.keys():
mvmt_id = applied_rule._get_id(movement_dict.pop('id'))
new_mvmt = applied_rule.newContent(id=mvmt_id,
portal_type=self.movement_type)
else:
new_mvmt = applied_rule.newContent(portal_type=self.movement_type)
new_mvmt.edit(**movement_dict)
# Pass to base class
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