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

bug fix : set the resource on every cell

fix reindexingo of every movement


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3756 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d55783c5
...@@ -126,6 +126,15 @@ class InvoiceTransactionRule(Rule, XMLMatrix): ...@@ -126,6 +126,15 @@ class InvoiceTransactionRule(Rule, XMLMatrix):
if movement.getId() not in my_cell_transaction_id_list : if movement.getId() not in my_cell_transaction_id_list :
applied_rule.deleteContent(movement.getId()) applied_rule.deleteContent(movement.getId())
# Add every movement from the Matrix to the Simulation
for transaction_line in my_cell.objectValues() :
if transaction_line.getId() in applied_rule.objectIds() :
simulation_movement = applied_rule[transaction_line.getId()]
else :
simulation_movement = applied_rule.newContent(
id = transaction_line.getId()
, portal_type=invoice_transaction_line_type)
# get the resource (in that order): # get the resource (in that order):
# resource from the invoice (using deliveryValue) # resource from the invoice (using deliveryValue)
# price_currency from the invoice # price_currency from the invoice
...@@ -159,15 +168,6 @@ class InvoiceTransactionRule(Rule, XMLMatrix): ...@@ -159,15 +168,6 @@ class InvoiceTransactionRule(Rule, XMLMatrix):
resource = order.getPriceCurrency() resource = order.getPriceCurrency()
simulation_movement = simulation_movement.getParent().getParent() simulation_movement = simulation_movement.getParent().getParent()
# Add every movement from the Matrix to the Simulation
for transaction_line in my_cell.objectValues() :
if transaction_line.getId() in applied_rule.objectIds() :
simulation_movement = applied_rule[transaction_line.getId()]
else :
simulation_movement = applied_rule.newContent(
id = transaction_line.getId()
, portal_type=invoice_transaction_line_type)
if resource is None : if resource is None :
# last resort : get the resource from the rule # last resort : get the resource from the rule
resource = transaction_line.getResource() or my_cell.getResource() resource = transaction_line.getResource() or my_cell.getResource()
...@@ -176,7 +176,7 @@ class InvoiceTransactionRule(Rule, XMLMatrix): ...@@ -176,7 +176,7 @@ class InvoiceTransactionRule(Rule, XMLMatrix):
"Unable to expand %s: no resource"%applied_rule.getPath()) "Unable to expand %s: no resource"%applied_rule.getPath())
raise ValueError, 'no resource for %s' % \ raise ValueError, 'no resource for %s' % \
transaction_line.getPath() transaction_line.getPath()
simulation_movement.edit( simulation_movement._edit(
source = transaction_line.getSource() source = transaction_line.getSource()
, destination = transaction_line.getDestination() , destination = transaction_line.getDestination()
, source_section = my_invoice_line_simulation.getSourceSection() , source_section = my_invoice_line_simulation.getSourceSection()
......
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