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

Support a 'simulation_state' parameter in...

Support a 'simulation_state' parameter in Invoice_getRemainingTotalPayablePrice, all related transaction in other simulation_state that the specified ones will be ignored

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14594 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 34277487
...@@ -84,10 +84,18 @@ this date.\n ...@@ -84,10 +84,18 @@ this date.\n
\n \n
The `account_id` parameter can be use to filter receivable / payable lines to a\n The `account_id` parameter can be use to filter receivable / payable lines to a\n
specific account.\n specific account.\n
\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
\'cancelled\' and \'deleted\'.\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
\n \n
if simulation_state is None:\n
state_list = [x[0] for x in Base_getTranslatedWorkflowStateItemList()]\n
simulation_state = [x for x in state_list if x not in (\'draft\', \'cancelled\', \'deleted\')]\n
\n
if context.AccountingTransaction_isSourceView():\n if context.AccountingTransaction_isSourceView():\n
is_source = 1\n is_source = 1\n
section = context.getSourceSection()\n section = context.getSourceSection()\n
...@@ -131,8 +139,7 @@ for line in context.getMovementList(\n ...@@ -131,8 +139,7 @@ for line in context.getMovementList(\n
# substract all causalities\n # substract all causalities\n
for related_transaction in context.getCausalityRelatedValueList(\n for related_transaction in context.getCausalityRelatedValueList(\n
portal_type=context.getPortalAccountingTransactionTypeList()):\n portal_type=context.getPortalAccountingTransactionTypeList()):\n
if related_transaction.getSimulationState() in (\n if related_transaction.getSimulationState() not in simulation_state:\n
\'draft\', \'cancelled\', \'deleted\'):\n
continue\n continue\n
\n \n
# if we have a payment related to multiple invoices, we cannot say the\n # if we have a payment related to multiple invoices, we cannot say the\n
...@@ -212,7 +219,7 @@ else:\n ...@@ -212,7 +219,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</string> </value> <value> <string>detailed=0, at_date=None, account_id=None, simulation_state=None</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -232,7 +239,7 @@ else:\n ...@@ -232,7 +239,7 @@ else:\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>3</int> </value> <value> <int>4</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -241,17 +248,24 @@ else:\n ...@@ -241,17 +248,24 @@ else:\n
<string>detailed</string> <string>detailed</string>
<string>at_date</string> <string>at_date</string>
<string>account_id</string> <string>account_id</string>
<string>simulation_state</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
<string>dict</string> <string>dict</string>
<string>total_payable_price_per_node_section</string> <string>total_payable_price_per_node_section</string>
<string>None</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>Base_getTranslatedWorkflowStateItemList</string>
<string>x</string>
<string>_getitem_</string>
<string>state_list</string>
<string>is_source</string> <string>is_source</string>
<string>section</string> <string>section</string>
<string>accounts_in_context</string> <string>accounts_in_context</string>
<string>_getiter_</string>
<string>line</string> <string>line</string>
<string>None</string>
<string>node_value</string> <string>node_value</string>
<string>line_section</string> <string>line_section</string>
<string>mirror_section</string> <string>mirror_section</string>
...@@ -259,8 +273,6 @@ else:\n ...@@ -259,8 +273,6 @@ else:\n
<string>key</string> <string>key</string>
<string>_write_</string> <string>_write_</string>
<string>related_transaction</string> <string>related_transaction</string>
<string>append</string>
<string>$append0</string>
<string>tr</string> <string>tr</string>
<string>other_invoice</string> <string>other_invoice</string>
<string>other_invoice_is_source</string> <string>other_invoice_is_source</string>
...@@ -285,6 +297,7 @@ else:\n ...@@ -285,6 +297,7 @@ else:\n
<int>0</int> <int>0</int>
<none/> <none/>
<none/> <none/>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
310 311
\ 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