Commit 514c9520 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: fix: do not use unrelated causality value

Builder passes all movement used to generate all the invoice
parent ff812ffd
...@@ -19,6 +19,10 @@ if invoice.getResource() != price_currency: ...@@ -19,6 +19,10 @@ if invoice.getResource() != price_currency:
causality_list = invoice.getCausalityList() causality_list = invoice.getCausalityList()
for simulation_movement in related_simulation_movement_path_list: for simulation_movement in related_simulation_movement_path_list:
simulation_movement = portal.restrictedTraverse(simulation_movement) simulation_movement = portal.restrictedTraverse(simulation_movement)
if not simulation_movement.getExplanation().startswith(invoice.getRelativeUrl()):
# Beware, the simulation movement may be not used to build the invoice
# related_simulation_movement_path_list is the movement_list used by the builder
continue
applied_rule = simulation_movement.getParentValue() applied_rule = simulation_movement.getParentValue()
if applied_rule.getParentId() != 'portal_simulation': if applied_rule.getParentId() != 'portal_simulation':
causality = applied_rule.getParentValue().getExplanationValue() causality = applied_rule.getParentValue().getExplanationValue()
......
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