Commit b77cece5 authored by Jérome Perrin's avatar Jérome Perrin

Changing properties on a planned order line should update the corresponding...

Changing properties on a planned order line should update the corresponding simulation, for invoice and accouting.

Rule: propagate values from prevision in _getCompensatedMovementList
InvoiceTransactionRule & InvoicingRule: add properties in _generatePrevision (project, function, payment)
testInvoice: tests that changes on the order line are reflected in invoice and accounting simulation



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20955 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bc2cfd7d
......@@ -124,8 +124,19 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
'id': transaction_line.getId(),
'source': transaction_line.getSource(),
'source_section': context_movement.getSourceSection(),
'source_decision': context_movement.getSourceDecision(),
'source_administration': context_movement.getSourceAdministration(),
'source_project': context_movement.getSourceProject(),
'source_function': context_movement.getSourceFunction(),
'source_payment': context_movement.getSourcePayment(),
'destination': transaction_line.getDestination(),
'destination_section': context_movement.getDestinationSection(),
'destination_section': context_movement.getDestinationSection(),
'destination_decision': context_movement.getDestinationDecision(),
'destination_administration': context_movement.getDestinationAdministration(),
'destination_project': context_movement.getDestinationProject(),
'destination_function': context_movement.getDestinationFunction(),
'destination_payment': context_movement.getDestinationPayment(),
'start_date': context_movement.getStartDate(),
'stop_date': context_movement.getStopDate(),
'resource': resource,
......
......@@ -92,10 +92,16 @@ class InvoicingRule(Rule):
'source_section': context_movement.getSourceSection(),
'source_decision': context_movement.getSourceDecision(),
'source_administration': context_movement.getSourceAdministration(),
'source_project': context_movement.getSourceProject(),
'source_function': context_movement.getSourceFunction(),
'source_payment': context_movement.getSourcePayment(),
'destination': context_movement.getDestination(),
'destination_section': context_movement.getDestinationSection(),
'destination_decision': context_movement.getDestinationDecision(),
'destination_administration': context_movement.getDestinationAdministration(),
'destination_project': context_movement.getDestinationProject(),
'destination_function': context_movement.getDestinationFunction(),
'destination_payment': context_movement.getDestinationPayment(),
'start_date': context_movement.getStartDate(),
'stop_date': context_movement.getStopDate(),
'resource': context_movement.getResource(),
......
......@@ -315,19 +315,26 @@ class Rule(Predicate, XMLObject):
else:
prevision['quantity'] = q_diff
add_list.append(prevision)
# Check the date
for movement in p_matched_list:
if movement in (mutable_movement_list \
+ deletable_movement_list):
prop_dict = modify_dict.setdefault(movement.getId(), {})
for prop in ('start_date', 'stop_date'):
#XXX should be >= 15
if prevision.get(prop) != movement.getProperty(prop):
prop_dict = modify_dict.setdefault(movement.getId(), {})
prop_dict[prop] = prevision.get(prop)
break
for k, v in prevision.items():
if v != movement.getProperty(k):
prop_dict.setdefault(k, v)
# update movement lists
for movement in p_matched_list:
non_matched_list.remove(movement)
# No movement matched, we need to create one
else:
add_list.append(prevision)
......
This diff is collapsed.
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