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

extend Invoice_getRemainingTotalPayablePrice to return the price only for a...

extend Invoice_getRemainingTotalPayablePrice to return the price only for a given mirror section. Actually this should almost always be passed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15253 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c3615c3d
...@@ -88,6 +88,9 @@ specific account.\n ...@@ -88,6 +88,9 @@ specific account.\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 \'cancelled\' and \'deleted\'.\n
\n
The `mirror_section_relative_url` parameter must be passed explicitly if the\n
context invoice has multiple sections.\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
...@@ -194,6 +197,12 @@ for related_transaction in context.getCausalityRelatedValueList(\n ...@@ -194,6 +197,12 @@ for related_transaction in context.getCausalityRelatedValueList(\n
if detailed:\n if detailed:\n
return total_payable_price_per_node_section\n return total_payable_price_per_node_section\n
else:\n else:\n
if mirror_section_relative_url:\n
total_amount = 0\n
for (node, mirror_section), amount in total_payable_price_per_node_section.items():\n
if mirror_section == mirror_section_relative_url:\n
total_amount += amount\n
return total_amount\n
return sum(total_payable_price_per_node_section.values())\n return sum(total_payable_price_per_node_section.values())\n
...@@ -219,7 +228,7 @@ else:\n ...@@ -219,7 +228,7 @@ else:\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>detailed=0, at_date=None, account_id=None, simulation_state=None</string> </value> <value> <string>detailed=0, at_date=None, account_id=None, simulation_state=None, mirror_section_relative_url=None</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -239,7 +248,7 @@ else:\n ...@@ -239,7 +248,7 @@ else:\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>4</int> </value> <value> <int>5</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -249,6 +258,7 @@ else:\n ...@@ -249,6 +258,7 @@ else:\n
<string>at_date</string> <string>at_date</string>
<string>account_id</string> <string>account_id</string>
<string>simulation_state</string> <string>simulation_state</string>
<string>mirror_section_relative_url</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
...@@ -280,6 +290,8 @@ else:\n ...@@ -280,6 +290,8 @@ else:\n
<string>ValueError</string> <string>ValueError</string>
<string>related_transaction_is_source</string> <string>related_transaction_is_source</string>
<string>date</string> <string>date</string>
<string>total_amount</string>
<string>node</string>
<string>sum</string> <string>sum</string>
</tuple> </tuple>
</value> </value>
...@@ -297,6 +309,7 @@ else:\n ...@@ -297,6 +309,7 @@ else:\n
<none/> <none/>
<none/> <none/>
<none/> <none/>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
358 360
\ 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