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

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
parent 8d69ccb4
...@@ -74,11 +74,16 @@ ...@@ -74,11 +74,16 @@
invoice and all payments that have been made on this invoice.\n invoice and all payments that have been made on this invoice.\n
For this, we use both causality relation between transactions and grouping\n For this, we use both causality relation between transactions and grouping\n
reference for lines.\n reference for lines.\n
\n
If `detailed` argument is set to a true value, instead of returning the price\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 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 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 particuliar date. This simply ignores related payments or transactions after\n
this date.\n this date.\n
\n
The `account_id` parameter can be use to filter receivable / payable lines to a\n
specific account.\n
"""\n """\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
total_payable_price_per_node_section = dict()\n total_payable_price_per_node_section = dict()\n
...@@ -115,6 +120,8 @@ for line in context.getMovementList(\n ...@@ -115,6 +120,8 @@ for line in context.getMovementList(\n
\n \n
if node_value is not None and \\\n if node_value is not None and \\\n
node_value.getAccountTypeId() in (\'payable\', \'receivable\'):\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 key = (node_value.getRelativeUrl(), mirror_section)\n
total_payable_price_per_node_section[key] =\\\n total_payable_price_per_node_section[key] =\\\n
total_payable_price_per_node_section.get(key, 0) + amount\n total_payable_price_per_node_section.get(key, 0) + amount\n
...@@ -205,7 +212,7 @@ else:\n ...@@ -205,7 +212,7 @@ else:\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -225,7 +232,7 @@ else:\n ...@@ -225,7 +232,7 @@ else:\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>2</int> </value> <value> <int>3</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -233,6 +240,7 @@ else:\n ...@@ -233,6 +240,7 @@ else:\n
<tuple> <tuple>
<string>detailed</string> <string>detailed</string>
<string>at_date</string> <string>at_date</string>
<string>account_id</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
...@@ -276,6 +284,7 @@ else:\n ...@@ -276,6 +284,7 @@ else:\n
<tuple> <tuple>
<int>0</int> <int>0</int>
<none/> <none/>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
299 300
\ 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