From b805a87fdf5f75310a24fa7d09da72804ce477f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 4 May 2007 10:44:19 +0000
Subject: [PATCH] Add account_id parameter to filter lines in
 Invoice_getRemainingTotalPayablePrice

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14354 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Invoice_getRemainingTotalPayablePrice.xml       | 13 +++++++++++--
 bt5/erp5_accounting/bt/revision                     |  2 +-
 2 files changed, 12 insertions(+), 3 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 22421d82ec..41e33f047c 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
@@ -74,11 +74,16 @@
 invoice and all payments that have been made on this invoice.\n
 For this, we use both causality relation between transactions and grouping\n
 reference for lines.\n
+\n
 If `detailed` argument is set to a true value, instead of returning the price\n
 as a float value, it returns a mapping (node, mirror_section) -> total_price.\n
+\n
 The `at_date` paremeter is when you want to know the remaining amount at a\n
 particuliar date. This simply ignores related payments or transactions after\n
 this date.\n
+\n
+The `account_id` parameter can be use to filter receivable / payable lines to a\n
+specific account.\n
 """\n
 portal = context.getPortalObject()\n
 total_payable_price_per_node_section = dict()\n
@@ -115,6 +120,8 @@ for line in context.getMovementList(\n
   \n
   if node_value is not None and \\\n
       node_value.getAccountTypeId() in (\'payable\', \'receivable\'):\n
+    if account_id is not None and node_value.getId() != account_id:\n
+      continue\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
@@ -205,7 +212,7 @@ else:\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>detailed=0, at_date=None</string> </value>
+            <value> <string>detailed=0, at_date=None, account_id=None</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -225,7 +232,7 @@ else:\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>2</int> </value>
+                        <value> <int>3</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
@@ -233,6 +240,7 @@ else:\n
                           <tuple>
                             <string>detailed</string>
                             <string>at_date</string>
+                            <string>account_id</string>
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>portal</string>
@@ -276,6 +284,7 @@ else:\n
               <tuple>
                 <int>0</int>
                 <none/>
+                <none/>
               </tuple>
             </value>
         </item>
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index f491e22fc0..f1efb20540 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-299
\ No newline at end of file
+300
\ No newline at end of file
-- 
2.30.9