From 46450ae5ebf69c8afae1b040584eeaae9e9414c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 23 Mar 2007 18:07:24 +0000
Subject: [PATCH] When calculating the remaining price, only consider payable /
 receivable accounts that are used on this invoice (ie. if another account is
 used in a related tansaction, ignore this amount).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13604 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Invoice_getRemainingTotalPayablePrice.xml            | 9 +++++----
 bt5/erp5_accounting/bt/revision                          | 2 +-
 2 files changed, 6 insertions(+), 5 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 8104d27522..4fb0582973 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
@@ -131,8 +131,8 @@ for related_transaction in context.getCausalityRelatedValueList(\n
   # if we have a payment related to multiple invoices, we cannot say the\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
+             portal_type=context.getPortalAccountingTransactionTypeList())\n
+             if tr != context ]:\n
     other_invoice_is_source = \\\n
                     other_invoice.AccountingTransaction_isSourceView()\n
     for other_line in other_invoice.getMovementList(\n
@@ -168,8 +168,9 @@ for related_transaction in context.getCausalityRelatedValueList(\n
     \n
     if node_value is not None and \\\n
         node_value.getAccountTypeId() in (\'payable\', \'receivable\'):\n
-      key = (node_value.getRelativeUrl(), mirror_section)\n
-      total_payable_price_per_node_section[key] =\\\n
+      if node_value in accounts_in_context:\n
+        key = (node_value.getRelativeUrl(), mirror_section)\n
+        total_payable_price_per_node_section[key] =\\\n
             total_payable_price_per_node_section.get(key, 0) + amount\n
 \n
 if detailed:\n
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index fba8ce006f..bcad85486c 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-224
\ No newline at end of file
+225
\ No newline at end of file
-- 
2.30.9