Commit 5d4d1dc6 authored by Jérome Perrin's avatar Jérome Perrin

Handle the case of a related payment has more than one causality, but all...

Handle the case of a related payment has more than one causality, but all those causalities are also in the group of transactions we are currently calculating.
This is required to support reversal of payment transactions: the reversal has for causality the invoice and the first payment transaction, it's a case where a payment transaction have more than one causality, but we are able to calculate.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15579 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1cb78dc5
...@@ -87,7 +87,7 @@ specific account.\n ...@@ -87,7 +87,7 @@ specific account.\n
\n \n
The `simulation_state` parameter is a list that can be used to take into account\n The `simulation_state` parameter is a list that can be used to take into account\n
only transactions in those states. By default it will use all but \'draft\', \n only transactions in those states. By default it will use all but \'draft\', \n
\'cancelled\' and \'deleted\'.\n , \'rejected\', \'cancelled\' and \'deleted\'.\n
\n \n
The `mirror_section_relative_url` parameter must be passed explicitly if the\n The `mirror_section_relative_url` parameter must be passed explicitly if the\n
context invoice has multiple sections.\n context invoice has multiple sections.\n
...@@ -97,7 +97,8 @@ total_payable_price_per_node_section = dict()\n ...@@ -97,7 +97,8 @@ total_payable_price_per_node_section = dict()\n
\n \n
if simulation_state is None:\n if simulation_state is None:\n
state_list = [x[1] for x in context.Base_getTranslatedWorkflowStateItemList(wf_id=\'accounting_workflow\')]\n state_list = [x[1] for x in context.Base_getTranslatedWorkflowStateItemList(wf_id=\'accounting_workflow\')]\n
simulation_state = [x for x in state_list if x not in (\'draft\', \'cancelled\', \'deleted\', \'rejected\')]\n simulation_state = [x for x in state_list\n
if x not in (\'draft\', \'cancelled\', \'deleted\', \'rejected\')]\n
\n \n
if context.AccountingTransaction_isSourceView():\n if context.AccountingTransaction_isSourceView():\n
is_source = 1\n is_source = 1\n
...@@ -138,10 +139,11 @@ for line in context.getMovementList(\n ...@@ -138,10 +139,11 @@ for line in context.getMovementList(\n
total_payable_price_per_node_section.get(key, 0) + amount\n total_payable_price_per_node_section.get(key, 0) + amount\n
accounts_in_context.append(node_value)\n accounts_in_context.append(node_value)\n
\n \n
related_transaction_list = context.getCausalityRelatedValueList(\n
portal_type=context.getPortalAccountingTransactionTypeList())\n
\n \n
# substract all causalities\n # substract all causalities\n
for related_transaction in context.getCausalityRelatedValueList(\n for related_transaction in related_transaction_list:\n
portal_type=context.getPortalAccountingTransactionTypeList()):\n
if related_transaction.getSimulationState() not in simulation_state:\n if related_transaction.getSimulationState() not in simulation_state:\n
continue\n continue\n
\n \n
...@@ -149,7 +151,7 @@ for related_transaction in context.getCausalityRelatedValueList(\n ...@@ -149,7 +151,7 @@ for related_transaction in context.getCausalityRelatedValueList(\n
# remaining price on those invoices.\n # remaining price on those invoices.\n
for other_invoice in [ tr for tr in related_transaction.getCausalityValueList(\n for other_invoice in [ tr for tr in related_transaction.getCausalityValueList(\n
portal_type=context.getPortalAccountingTransactionTypeList())\n portal_type=context.getPortalAccountingTransactionTypeList())\n
if tr != context ]:\n if tr not in related_transaction_list + [context]]:\n
other_invoice_is_source = \\\n other_invoice_is_source = \\\n
other_invoice.AccountingTransaction_isSourceView()\n other_invoice.AccountingTransaction_isSourceView()\n
for other_line in other_invoice.getMovementList(\n for other_line in other_invoice.getMovementList(\n
...@@ -281,6 +283,7 @@ else:\n ...@@ -281,6 +283,7 @@ else:\n
<string>amount</string> <string>amount</string>
<string>key</string> <string>key</string>
<string>_write_</string> <string>_write_</string>
<string>related_transaction_list</string>
<string>related_transaction</string> <string>related_transaction</string>
<string>tr</string> <string>tr</string>
<string>other_invoice</string> <string>other_invoice</string>
......
369 371
\ No newline at end of file \ No newline at end of file
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