Commit 3aa6cb6b authored by Jérome Perrin's avatar Jérome Perrin

use new API getAvailableBudgetDict, getEngagedBudgetDict and...

use new API getAvailableBudgetDict, getEngagedBudgetDict and getConsumedBudgetDict that does only one getInventoryList query for each budget line, and also shows consumptions for cells where no budget has been defined

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37226 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cb1b7e20
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>def getFakeBudgetCell(amount):\n
class FakeBudgetCell:\n
def getAvailableBudget(self):\n
return amount\n
def absolute_url(self):\n
return context.absolute_url()\n
return FakeBudgetCell()\n
\n
try:\n
available_budget_dict = container.REQUEST.other[script.getId()]\n
except KeyError:\n
available_budget_dict = container.REQUEST.other[script.getId()] = context.getAvailableBudgetDict()\n
\n
return getFakeBudgetCell(available_budget_dict[args])\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*args, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>args</string>
<string>kw</string>
<string>getFakeBudgetCell</string>
<string>_getitem_</string>
<string>_getattr_</string>
<string>container</string>
<string>script</string>
<string>available_budget_dict</string>
<string>KeyError</string>
<string>context</string>
<string>_write_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BudgetLine_getAvailableBudgetCell</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>def getFakeBudgetCell(amount):\n
class FakeBudgetCell:\n
def getConsumedBudget(self):\n
return amount\n
def absolute_url(self):\n
return context.absolute_url()\n
return FakeBudgetCell()\n
\n
try:\n
consumed_budget_dict = container.REQUEST.other[script.getId()]\n
except KeyError:\n
consumed_budget_dict = container.REQUEST.other[script.getId()] = context.getConsumedBudgetDict()\n
\n
return getFakeBudgetCell(consumed_budget_dict[args])\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*args, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>args</string>
<string>kw</string>
<string>getFakeBudgetCell</string>
<string>_getitem_</string>
<string>_getattr_</string>
<string>container</string>
<string>script</string>
<string>consumed_budget_dict</string>
<string>KeyError</string>
<string>context</string>
<string>_write_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BudgetLine_getConsumedBudgetCell</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>def getFakeBudgetCell(amount):\n
class FakeBudgetCell:\n
def getEngagedBudget(self):\n
return amount\n
def absolute_url(self):\n
return context.absolute_url()\n
return FakeBudgetCell()\n
\n
try:\n
engaged_budget_dict = container.REQUEST.other[script.getId()]\n
except KeyError:\n
engaged_budget_dict = container.REQUEST.other[script.getId()] = context.getEngagedBudgetDict()\n
\n
return getFakeBudgetCell(engaged_budget_dict[args])\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*args, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>args</string>
<string>kw</string>
<string>getFakeBudgetCell</string>
<string>_getitem_</string>
<string>_getattr_</string>
<string>container</string>
<string>script</string>
<string>engaged_budget_dict</string>
<string>KeyError</string>
<string>context</string>
<string>_write_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BudgetLine_getEngagedBudgetCell</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -13,6 +13,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>cell_getter_method</string>
<string>editable_attributes</string>
<string>global_attributes</string>
</list>
......@@ -75,6 +76,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>cell_getter_method</string> </key>
<value> <string>BudgetLine_getAvailableBudgetCell</string> </value>
</item>
<item>
<key> <string>editable_attributes</string> </key>
<value>
......
......@@ -13,6 +13,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>cell_getter_method</string>
<string>editable_attributes</string>
<string>global_attributes</string>
</list>
......@@ -75,6 +76,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>cell_getter_method</string> </key>
<value> <string>BudgetLine_getConsumedBudgetCell</string> </value>
</item>
<item>
<key> <string>editable_attributes</string> </key>
<value>
......
......@@ -13,6 +13,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>cell_getter_method</string>
<string>editable_attributes</string>
<string>global_attributes</string>
</list>
......@@ -75,6 +76,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>cell_getter_method</string> </key>
<value> <string>BudgetLine_getEngagedBudgetCell</string> </value>
</item>
<item>
<key> <string>editable_attributes</string> </key>
<value>
......
292
\ No newline at end of file
293
\ 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