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

It can be usefull to calculate the budget consumption using same parameters...

It can be usefull to calculate the budget consumption using same parameters but for another date range. Those scripts accepts from_date and at_date parameters for that usage

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30877 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3a89260c
......@@ -60,12 +60,17 @@ if budget_model is not None:\n
kw = budget_model.getInventoryQueryDict(context)\n
\n
kw.setdefault(\'from_date\', budget.getStartDateRangeMin())\n
at_date = budget.getStartDateRangeMax()\n
start_date_range_max = budget.getStartDateRangeMax()\n
if start_date_range_max:\n
start_date_range_max = start_date_range_max.latestTime()\n
kw.setdefault(\'at_date\', start_date_range_max)\n
\n
if from_date:\n
kw[\'from_date\'] = from_date\n
if at_date:\n
at_date = at_date.latestTime()\n
kw.setdefault(\'at_date\', at_date)\n
kw[\'at_date\'] = at_date\n
\n
# XXX use getBudgetConsumptionMethod ?\n
# XXX use getBudgetConsumptionMethod ?\n
if src__:\n
return context.portal_simulation.getCurrentInventoryAssetPrice(src__=src__, **kw)\n
return (context.portal_simulation.getCurrentInventoryAssetPrice(**kw) or 0) * context.getParentValue().BudgetLine_getConsumptionSign()\n
......@@ -79,7 +84,7 @@ return (context.portal_simulation.getCurrentInventoryAssetPrice(**kw) or 0) * co
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>src__=0</string> </value>
<value> <string>src__=0, from_date=None, at_date=None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -99,13 +104,15 @@ return (context.portal_simulation.getCurrentInventoryAssetPrice(**kw) or 0) * co
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>src__</string>
<string>from_date</string>
<string>at_date</string>
<string>dict</string>
<string>kw</string>
<string>_getattr_</string>
......@@ -113,7 +120,8 @@ return (context.portal_simulation.getCurrentInventoryAssetPrice(**kw) or 0) * co
<string>budget</string>
<string>budget_model</string>
<string>None</string>
<string>at_date</string>
<string>start_date_range_max</string>
<string>_write_</string>
<string>_apply_</string>
</tuple>
</value>
......@@ -128,6 +136,8 @@ return (context.portal_simulation.getCurrentInventoryAssetPrice(**kw) or 0) * co
<value>
<tuple>
<int>0</int>
<none/>
<none/>
</tuple>
</value>
</item>
......
......@@ -60,10 +60,15 @@ if budget_model is not None:\n
kw = budget_model.getInventoryQueryDict(context)\n
\n
kw.setdefault(\'from_date\', budget.getStartDateRangeMin())\n
at_date = budget.getStartDateRangeMax()\n
start_date_range_max = budget.getStartDateRangeMax()\n
if start_date_range_max:\n
start_date_range_max = start_date_range_max.latestTime()\n
kw.setdefault(\'at_date\', start_date_range_max)\n
\n
if from_date:\n
kw[\'from_date\'] = from_date\n
if at_date:\n
at_date = at_date.latestTime()\n
kw.setdefault(\'at_date\', at_date)\n
kw[\'at_date\'] = at_date\n
\n
kw.setdefault(\'explanation_simulation_state\', context.getPortalReservedInventoryStateList() \\\n
+ context.getPortalCurrentInventoryStateList() \\\n
......@@ -83,7 +88,7 @@ return (context.portal_simulation.getInventoryAssetPrice(**kw) or 0) * context.g
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>src__=0</string> </value>
<value> <string>src__=0, from_date=None, at_date=None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -103,13 +108,15 @@ return (context.portal_simulation.getInventoryAssetPrice(**kw) or 0) * context.g
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>src__</string>
<string>from_date</string>
<string>at_date</string>
<string>dict</string>
<string>kw</string>
<string>_getattr_</string>
......@@ -117,7 +124,8 @@ return (context.portal_simulation.getInventoryAssetPrice(**kw) or 0) * context.g
<string>budget</string>
<string>budget_model</string>
<string>None</string>
<string>at_date</string>
<string>start_date_range_max</string>
<string>_write_</string>
<string>_apply_</string>
</tuple>
</value>
......@@ -132,6 +140,8 @@ return (context.portal_simulation.getInventoryAssetPrice(**kw) or 0) * context.g
<value>
<tuple>
<int>0</int>
<none/>
<none/>
</tuple>
</value>
</item>
......
258
\ No newline at end of file
260
\ 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