Commit 583b892e authored by Kevin Deldycke's avatar Kevin Deldycke

Remove previous hack by a less intrusive one.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6713 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bd731933
......@@ -81,7 +81,7 @@ at_date = preference.getPreferredAccountingTransactionAtDate()\n
# Build the common inventory dict\n
params = {}\n
\n
if kw.get(\'no_from_date\', 0): from_date = None\n
if kw.get(\'no_from_date\', False): from_date = None\n
\n
if simulation_state: params[\'simulation_state\'] = simulation_state\n
if section_category: params[\'section_category\'] = section_category\n
......@@ -93,22 +93,19 @@ if kw.has_key(\'portal_type\'): params[\'portal_type\'] = kw[\'portal_type\']\n
new_result = []\n
net_balance = 0.0\n
\n
if from_date is not None :\n
if from_date is not None:\n
# Create a new parameter list to get the previous balance\n
get_inventory_kw = params.copy()\n
get_inventory_kw.update({ \'omit_simulation\' : 1\n
, \'to_date\' : from_date\n
, \'mirror_section_uid\' : context.getUid()\n
, \'section_portal_type_list\': [\'Organisation\']\n
get_inventory_kw.update({ \'omit_simulation\' : True\n
, \'to_date\' : from_date\n
, \'mirror_section_uid\': context.getUid()\n
, \'where_expression\' : " section.portal_type = \'Organisation\' "\n
})\n
getInventory = context.getPortalObject()\\\n
.portal_simulation.getInventoryAssetPrice\n
getInventory = context.getPortalObject().portal_simulation.getInventoryAssetPrice\n
# Get previous debit and credit\n
previous_total_debit = r_(getInventory(omit_output=1,\n
**get_inventory_kw))\n
previous_total_credit = r_(getInventory(omit_input =1,\n
**get_inventory_kw))\n
if previous_total_credit != 0 :\n
previous_total_debit = r_(getInventory(omit_output=True, **get_inventory_kw))\n
previous_total_credit = r_(getInventory(omit_input =True, **get_inventory_kw))\n
if previous_total_credit != 0:\n
previous_total_credit = - previous_total_credit\n
\n
# Show the previous balance if not empty\n
......@@ -166,10 +163,11 @@ for l in result:\n
, parent_reference = l.parent_reference\n
, parent_specific_reference = l.parent_specific_reference\n
, translated_simulation_state_title = o.getTranslatedSimulationStateTitle()\n
# FIXME: overriding \'portal_type\' in asContext is clearly a bad idea, as many methods are storred on the portal type\n
# (hence the translated_simulation_state_title hack) -j\xc3\xa9rome\n
, portal_type = l.portal_type\n
, account_uid = l.account_uid\n
# FIXME: Overriding \'portal_type\' in asContext is clearly a bad idea,\n
# as many methods are storred on the portal type (hence the\n
# translated_simulation_state_title hack). --jerome\n
, portal_type = l.portal_type\n
)\n
new_result.append(c)\n
\n
......@@ -233,11 +231,13 @@ return new_result\n
<string>from_date</string>
<string>at_date</string>
<string>params</string>
<string>False</string>
<string>None</string>
<string>_write_</string>
<string>new_result</string>
<string>net_balance</string>
<string>get_inventory_kw</string>
<string>True</string>
<string>getInventory</string>
<string>_apply_</string>
<string>previous_total_debit</string>
......@@ -245,7 +245,6 @@ return new_result\n
<string>Products.ERP5Type.Document</string>
<string>newTempAccountingTransaction</string>
<string>previous_balance</string>
<string>True</string>
<string>result</string>
<string>_getiter_</string>
<string>l</string>
......
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