Commit 061b12ea authored by Kevin Deldycke's avatar Kevin Deldycke

Remove previous hack by a less intrusive one.

Code clean-up.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6703 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 62710424
......@@ -70,45 +70,50 @@
from DateTime import DateTime\n
from Products.ERP5Type.Document import newTempBase\n
\n
selection_params = selection.getParams()\n
get_inventory_kw = {}\n
get_inventory_kw[\'section_category\'] = selection_params.get(\'section_category\')\n
get_inventory_kw[\'simulation_state\'] = selection_params.get(\'transaction_simulation_state\')\n
get_inventory_kw[\'node_category\'] = selection_params.get(\'gap_root\')\n
get_inventory_kw[\'omit_simulation\'] = 1\n
get_inventory_kw[\'section_portal_type_list\'] = [\'Organisation\']\n
get_inventory_kw = {\n
\'section_category\': selection_params.get(\'section_category\')\n
, \'simulation_state\': selection_params.get(\'simulation_state\')\n
, \'node_category\' : selection_params.get(\'gap_root\')\n
, \'omit_simulation\' : True\n
, \'where_expression\': " section.portal_type = \'Organisation\' "\n
}\n
\n
no_start_date = DateTime(1970, 1, 1)\n
at_date = selection_params.get(\'at_date\', None)\n
from_date = selection_params.get(\'from_date\', None)\n
\n
portal = context.getPortalObject()\n
getInventory = portal.portal_simulation.getInventoryAssetPrice\n
\n
# FIXME: Here we do not want to sum all movement < 0, but sum the balances\n
# of all nodes whose which have a < 0 balance...\n
opening_debit_balance = getInventory( at_date = from_date\n
, omit_output = True\n
, **get_inventory_kw\n
)\n
closing_debit_balance = getInventory( at_date = at_date\n
, omit_output = True\n
, **get_inventory_kw\n
)\n
opening_credit_balance = - getInventory( at_date = from_date\n
, omit_input = True\n
, **get_inventory_kw\n
)\n
closing_credit_balance = - getInventory( at_date = at_date\n
, omit_input = True\n
, **get_inventory_kw\n
)\n
\n
list_item = newTempBase(portal, \'xxx\')\n
list_item.setUid(\'new_000\')\n
list_item.edit(** {\n
# FIXME: here we do not want to sum all movement < 0, but sum the balances\n
# of all nodes whose which have a < 0 balance...\n
\'total_opening_debit_balance\' : getInventory(\n
at_date = selection_params.get(\'from_date\', no_start_date),\n
omit_output = 1,\n
**get_inventory_kw) or 0,\n
\n
\'total_opening_credit_balance\' : - getInventory(\n
at_date = selection_params.get(\'from_date\', no_start_date),\n
omit_input = 1,\n
**get_inventory_kw) or 0,\n
\n
\'total_closing_debit_balance\' : getInventory(\n
at_date = selection_params.get(\'at_date\'),\n
omit_output = 1,\n
**get_inventory_kw) or 0,\n
\n
\'total_closing_credit_balance\' : - getInventory(\n
at_date = selection_params.get(\'at_date\'),\n
omit_input = 1,\n
**get_inventory_kw) or 0,\n
\'total_opening_debit_balance\' : opening_debit_balance or 0\n
, \'total_closing_debit_balance\' : closing_debit_balance or 0\n
, \'total_opening_credit_balance\': opening_credit_balance or 0\n
, \'total_closing_credit_balance\': closing_credit_balance or 0\n
})\n
\n
return [list_item]\n
......@@ -165,14 +170,20 @@ return [list_item]\n
<string>newTempBase</string>
<string>_getattr_</string>
<string>selection_params</string>
<string>True</string>
<string>get_inventory_kw</string>
<string>_write_</string>
<string>no_start_date</string>
<string>None</string>
<string>at_date</string>
<string>from_date</string>
<string>context</string>
<string>portal</string>
<string>getInventory</string>
<string>list_item</string>
<string>_apply_</string>
<string>opening_debit_balance</string>
<string>closing_debit_balance</string>
<string>opening_credit_balance</string>
<string>closing_credit_balance</string>
<string>list_item</string>
</tuple>
</value>
</item>
......
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