From 5d4d1dc6bfc26d8548b451426f3080099336b8c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Thu, 9 Aug 2007 12:40:25 +0000 Subject: [PATCH] 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 --- .../Invoice_getRemainingTotalPayablePrice.xml | 13 ++++++++----- bt5/erp5_accounting/bt/revision | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_getRemainingTotalPayablePrice.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_getRemainingTotalPayablePrice.xml index 9423b2325f..badbf14cb1 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_getRemainingTotalPayablePrice.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_getRemainingTotalPayablePrice.xml @@ -87,7 +87,7 @@ specific account.\n \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 -\'cancelled\' and \'deleted\'.\n +, \'rejected\', \'cancelled\' and \'deleted\'.\n \n The `mirror_section_relative_url` parameter must be passed explicitly if the\n context invoice has multiple sections.\n @@ -97,7 +97,8 @@ total_payable_price_per_node_section = dict()\n \n if simulation_state is None:\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 if context.AccountingTransaction_isSourceView():\n is_source = 1\n @@ -138,10 +139,11 @@ for line in context.getMovementList(\n total_payable_price_per_node_section.get(key, 0) + amount\n accounts_in_context.append(node_value)\n \n +related_transaction_list = context.getCausalityRelatedValueList(\n + portal_type=context.getPortalAccountingTransactionTypeList())\n \n # substract all causalities\n -for related_transaction in context.getCausalityRelatedValueList(\n - portal_type=context.getPortalAccountingTransactionTypeList()):\n +for related_transaction in related_transaction_list:\n if related_transaction.getSimulationState() not in simulation_state:\n continue\n \n @@ -149,7 +151,7 @@ for related_transaction in context.getCausalityRelatedValueList(\n # remaining price on those invoices.\n for other_invoice in [ tr for tr in related_transaction.getCausalityValueList(\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.AccountingTransaction_isSourceView()\n for other_line in other_invoice.getMovementList(\n @@ -281,6 +283,7 @@ else:\n <string>amount</string> <string>key</string> <string>_write_</string> + <string>related_transaction_list</string> <string>related_transaction</string> <string>tr</string> <string>other_invoice</string> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index 8c19d14d40..1c3e15e55e 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -369 \ No newline at end of file +371 \ No newline at end of file -- 2.30.9