Commit 2489af45 authored by Jérome Perrin's avatar Jérome Perrin Committed by Vincent Pelletier

accounting: do not pass unhandled catalog parameters to inventory API

parent 45c1d70b
......@@ -51,6 +51,9 @@
<item>
<key> <string>_body</string> </key>
<value> <string>kwd = context.ERP5Accounting_getParams(selection_name)\n
# cleanup unsupported catalog parameters\n
kwd.pop(\'period_start_date\', None)\n
kwd.pop(\'detailed_from_date_summary\', None)\n
\n
if kw.get(\'stat\'):\n
selection_params = context.portal_selections.getSelectionParamsFor(selection_name)\n
......@@ -62,15 +65,14 @@ if kw.get(\'stat\'):\n
kwd[\'selection_domain\'] = selection_domain\n
if selection_report:\n
kwd[\'selection_report\'] = selection_report\n
if selection_params.get(\'closed_summary\'):\n
kwd[\'closed_summary\'] = selection_params[\'closed_summary\']\n
if context.portal_selections.getSelectionInvertModeFor(selection_name):\n
kwd[\'stock.node_uid\'] = context.portal_selections.getSelectionInvertModeUidListFor(selection_name)\n
# is list filtered ?\n
elif \'title\' in selection_params or \\\n
\'preferred_gap_id\' in selection_params or\\\n
\'id\' in selection_params or \\\n
\'transalated_validation_state_title\' in selection_params:\n
\'preferred_gap_id\' in selection_params or\\\n
\'id\' in selection_params or \\\n
\'transalated_validation_state_title\' in selection_params:\n
selection_params[\'ignore_unknown_columns\'] = True\n
# if yes, apply the same filter here\n
kwd[\'stock.node_uid\'] = [x.uid for x in\n
context.portal_catalog(**selection_params)]\n
......@@ -79,6 +81,7 @@ if kw.get(\'stat\'):\n
return context.portal_simulation.getInventoryStat( **kwd )[0][\'stock_uid\']\n
\n
kwd[\'stock.node_uid\'] = brain.uid\n
\n
return context.portal_simulation.getInventoryStat( **kwd )[0][\'stock_uid\']\n
# vim: syntax=python\n
</string> </value>
......
......@@ -57,6 +57,10 @@ params[\'omit_asset_decrease\'] = omit_asset_decrease\n
# For now, we omit simulation to be compatible with other reports.\n
params[\'omit_simulation\'] = True\n
\n
# Remove params used internally by ERP5Accounting_getParams before passing to inventory API\n
params.pop("period_start_date", None)\n
params.pop("detailed_from_date_summary", None)\n
\n
return portal.portal_simulation.getInventoryAssetPrice(\n
node_uid=brain.uid,\n
**params )\n
......
......@@ -75,6 +75,7 @@ elif \'title\' in selection_params or \\\n
\'preferred_gap_id\' in selection_params or \\\n
\'id\' in selection_params or \\\n
\'translated_validation_state_title\' in selection_params:\n
selection_params[\'ignore_unknown_columns\'] = True\n
# if list is filtered, apply the same filter here\n
params[\'node_uid\'] = [x.uid for x in\n
portal.portal_catalog(**selection_params)]\n
......@@ -82,6 +83,10 @@ else:\n
# make sure we only have Accounts as nodes\n
params[\'node_category\'] = [\'account_type\',]\n
\n
# Remove params used internally by ERP5Accounting_getParams before passing to inventory API\n
params.pop("period_start_date", None)\n
params.pop("detailed_from_date_summary", None)\n
\n
return portal.portal_simulation.getInventoryAssetPrice( **params )\n
</string> </value>
</item>
......
......@@ -114,8 +114,10 @@ if kw.get(\'where_expression\'):\n
if not \'parent_portal_type\' in params:\n
params.setdefault(\'portal_type\', portal.getPortalAccountingMovementTypeList())\n
\n
period_start_date = params.pop(\'period_start_date\', None)\n
# Remove unsupported inventory API parameters\n
params.pop(\'detailed_from_date_summary\', None)\n
\n
period_start_date = params.pop(\'period_start_date\', None)\n
if period_start_date and params.get(\'node_uid\'):\n
# find the node for this node_uid\n
if context.getUid() == params[\'node_uid\']: # I bet it\'s context\n
......
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