Commit 5e4c032c authored by Jérome Perrin's avatar Jérome Perrin

Add a at_date parameter to Invoice_getRemainingTotalPayablePrice, to ignore...

Add a at_date parameter to Invoice_getRemainingTotalPayablePrice, to ignore payments after this date.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14296 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f2c01f40
...@@ -76,6 +76,9 @@ For this, we use both causality relation between transactions and grouping\n ...@@ -76,6 +76,9 @@ For this, we use both causality relation between transactions and grouping\n
reference for lines.\n reference for lines.\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
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 """\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
...@@ -109,6 +112,7 @@ for line in context.getMovementList(\n ...@@ -109,6 +112,7 @@ for line in context.getMovementList(\n
line_section = line.getDestinationSection()\n line_section = line.getDestinationSection()\n
mirror_section = line.getSourceSection()\n mirror_section = line.getSourceSection()\n
amount = line.getDestinationInventoriatedTotalAssetPrice() or 0\n amount = line.getDestinationInventoriatedTotalAssetPrice() or 0\n
\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
...@@ -160,14 +164,18 @@ for related_transaction in context.getCausalityRelatedValueList(\n ...@@ -160,14 +164,18 @@ for related_transaction in context.getCausalityRelatedValueList(\n
line_section = line.getSourceSection()\n line_section = line.getSourceSection()\n
mirror_section = line.getDestinationSection()\n mirror_section = line.getDestinationSection()\n
amount = line.getSourceInventoriatedTotalAssetPrice() or 0\n amount = line.getSourceInventoriatedTotalAssetPrice() or 0\n
date = line.getStartDate().earliestTime()\n
else:\n else:\n
node_value = line.getDestinationValue(portal_type=\'Account\')\n node_value = line.getDestinationValue(portal_type=\'Account\')\n
line_section = line.getDestinationSection()\n line_section = line.getDestinationSection()\n
mirror_section = line.getSourceSection()\n mirror_section = line.getSourceSection()\n
amount = line.getDestinationInventoriatedTotalAssetPrice() or 0\n amount = line.getDestinationInventoriatedTotalAssetPrice() or 0\n
date = line.getStopDate().earliestTime()\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 at_date and date > at_date:\n
continue\n
if node_value in accounts_in_context:\n if node_value in accounts_in_context:\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
...@@ -201,7 +209,7 @@ else:\n ...@@ -201,7 +209,7 @@ else:\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>detailed=0</string> </value> <value> <string>detailed=0, at_date=None</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -221,13 +229,14 @@ else:\n ...@@ -221,13 +229,14 @@ else:\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>1</int> </value> <value> <int>2</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>detailed</string> <string>detailed</string>
<string>at_date</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
...@@ -256,6 +265,7 @@ else:\n ...@@ -256,6 +265,7 @@ else:\n
<string>other_invoice_line_account</string> <string>other_invoice_line_account</string>
<string>ValueError</string> <string>ValueError</string>
<string>related_transaction_is_source</string> <string>related_transaction_is_source</string>
<string>date</string>
<string>sum</string> <string>sum</string>
</tuple> </tuple>
</value> </value>
...@@ -270,6 +280,7 @@ else:\n ...@@ -270,6 +280,7 @@ else:\n
<value> <value>
<tuple> <tuple>
<int>0</int> <int>0</int>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
290 292
\ 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