Commit c70b3e9f authored by Aurel's avatar Aurel

optimize fast input render in a dirty way (check the limit manually instead of using the catalog)

add a count method on the listbox as we no longer retrieve all listbox's lines

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27982 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ce087269
...@@ -365,7 +365,9 @@ ...@@ -365,7 +365,9 @@
</item> </item>
<item> <item>
<key> <string>count_method</string> </key> <key> <string>count_method</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
...@@ -439,7 +441,7 @@ ...@@ -439,7 +441,7 @@
<item> <item>
<key> <string>list_method</string> </key> <key> <string>list_method</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -550,6 +552,22 @@ ...@@ -550,6 +552,22 @@
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>ListBox_countCheckbook</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<tuple> <tuple>
<global name="Method" module="Products.Formulator.MethodField"/> <global name="Method" module="Products.Formulator.MethodField"/>
......
...@@ -65,7 +65,9 @@ ...@@ -65,7 +65,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># Look at all items availables for the source and then\n <value> <string encoding="cdata"><![CDATA[
# Look at all items availables for the source and then\n
# display them on a listbox so that the user will be able\n # display them on a listbox so that the user will be able\n
# to select them\n # to select them\n
from DateTime import DateTime\n from DateTime import DateTime\n
...@@ -102,6 +104,9 @@ if listbox is None:\n ...@@ -102,6 +104,9 @@ if listbox is None:\n
current_tracking_list = getCurrentTrackingList(to_date=at_date,\n current_tracking_list = getCurrentTrackingList(to_date=at_date,\n
node=node,\n node=node,\n
where_expression="item_catalog.portal_type=\'Check\' or item_catalog.portal_type=\'Checkbook\'")\n where_expression="item_catalog.portal_type=\'Check\' or item_catalog.portal_type=\'Checkbook\'")\n
\n
if count is True:\n
return len(current_tracking_list)\n
\n \n
for item in current_tracking_list:\n for item in current_tracking_list:\n
item = item.getObject()\n item = item.getObject()\n
...@@ -136,18 +141,21 @@ if listbox is None:\n ...@@ -136,18 +141,21 @@ if listbox is None:\n
destination_payment_value = item.getDestinationPaymentValue()\n destination_payment_value = item.getDestinationPaymentValue()\n
if destination_payment_value is not None:\n if destination_payment_value is not None:\n
internal_bank_account_number = destination_payment_value.getInternalBankAccountNumber()\n internal_bank_account_number = destination_payment_value.getInternalBankAccountNumber()\n
if reference is not None and reference != internal_bank_account_number:\n if reference not in (None, \'\') and reference != internal_bank_account_number:\n
continue\n continue\n
item_dict[\'internal_bank_account_number\'] = internal_bank_account_number\n item_dict[\'internal_bank_account_number\'] = internal_bank_account_number\n
item_dict[\'account_owner\'] = item.getDestinationPaymentTitle()\n item_dict[\'account_owner\'] = item.getDestinationPaymentTitle()\n
item_dict[\'recept_date\'] = item.getStartDate()\n item_dict[\'recept_date\'] = item.getStartDate()\n
item_dict[\'selection\'] = 0\n item_dict[\'selection\'] = 0\n
item_dict[\'uid\'] = \'new_%s\' %(item.getUid(),)\n item_dict[\'uid\'] = \'new_%s\' %(item.getUid(),)\n
\n
listbox.append(item_dict)\n listbox.append(item_dict)\n
if len(listbox) > limit[0]+limit[1]-1:\n
break\n
\n \n
return listbox\n return listbox\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -169,7 +177,7 @@ return listbox\n ...@@ -169,7 +177,7 @@ return listbox\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=None, item_portal_type_list=None,destination_payment=None,model_filter_dict=None,batch_mode=0,simulation_state=None,disable_node=0,at_date=None,reference=None,**kw</string> </value> <value> <string>listbox=None, item_portal_type_list=None,destination_payment=None,model_filter_dict=None,batch_mode=0,simulation_state=None,disable_node=0,at_date=None,reference=None,limit=None,count=False,**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
...@@ -197,7 +205,7 @@ return listbox\n ...@@ -197,7 +205,7 @@ return listbox\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>9</int> </value> <value> <int>11</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -212,6 +220,8 @@ return listbox\n ...@@ -212,6 +220,8 @@ return listbox\n
<string>disable_node</string> <string>disable_node</string>
<string>at_date</string> <string>at_date</string>
<string>reference</string> <string>reference</string>
<string>limit</string>
<string>count</string>
<string>kw</string> <string>kw</string>
<string>DateTime</string> <string>DateTime</string>
<string>Dummy</string> <string>Dummy</string>
...@@ -224,6 +234,8 @@ return listbox\n ...@@ -224,6 +234,8 @@ return listbox\n
<string>item_list</string> <string>item_list</string>
<string>getCurrentTrackingList</string> <string>getCurrentTrackingList</string>
<string>current_tracking_list</string> <string>current_tracking_list</string>
<string>True</string>
<string>len</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>item</string> <string>item</string>
<string>exclude</string> <string>exclude</string>
...@@ -235,6 +247,7 @@ return listbox\n ...@@ -235,6 +247,7 @@ return listbox\n
<string>_write_</string> <string>_write_</string>
<string>destination_payment_value</string> <string>destination_payment_value</string>
<string>internal_bank_account_number</string> <string>internal_bank_account_number</string>
<string>_getitem_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -256,6 +269,8 @@ return listbox\n ...@@ -256,6 +269,8 @@ return listbox\n
<int>0</int> <int>0</int>
<none/> <none/>
<none/> <none/>
<none/>
<int>0</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
<?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>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</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># Look at all items availables for the source and then\n
# display them on a listbox so that the user will be able\n
# to select them\n
request = context.REQUEST\n
item_portal_type_list = ["Checkbook","Check"]\n
node = context.getBaobabSource()\n
\n
fast_input_type = getattr(request, \'your_fast_input_type\', None)\n
if fast_input_type is None:\n
fast_input_type = getattr(request, \'field_your_fast_input_type\')\n
\n
disable_node = 0\n
at_date = context.getStartDate()\n
\n
if fast_input_type == \'traveler_check_purchase\':\n
item_portal_type_list = (\'Check\',)\n
disable_node = 1\n
\n
nb = context.Delivery_getCheckbookList(\n
item_portal_type_list=item_portal_type_list,\n
disable_node=disable_node,\n
at_date=at_date,\n
node=node,\n
count=True)\n
\n
return [[nb,],]\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</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>_getattr_</string>
<string>context</string>
<string>request</string>
<string>item_portal_type_list</string>
<string>node</string>
<string>getattr</string>
<string>None</string>
<string>fast_input_type</string>
<string>disable_node</string>
<string>at_date</string>
<string>True</string>
<string>nb</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>ListBox_countCheckbook</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -68,17 +68,15 @@ ...@@ -68,17 +68,15 @@
<value> <string># Look at all items availables for the source and then\n <value> <string># Look at all items availables for the source and then\n
# display them on a listbox so that the user will be able\n # display them on a listbox so that the user will be able\n
# to select them\n # to select them\n
from DateTime import DateTime\n
request = context.REQUEST\n request = context.REQUEST\n
item_portal_type_list = ["Checkbook","Check"]\n item_portal_type_list = ["Checkbook","Check"]\n
node = context.getBaobabSource()\n node = context.getBaobabSource()\n
#item_portal_type_list = request.get(\'item_portal_type_list\', ["Checkbook","Check"])\n
#node = request.get(\'node\', request.get(\'vault\', context.getBaobabSource()))\n
destination_payment = request.get(\'destination_payment\', None)\n destination_payment = request.get(\'destination_payment\', None)\n
reference_date = DateTime()\n \n
item_list = []\n # retrieve listbox limit\n
listbox = []\n nb_lines = int(kw.get(\'list_lines\'))\n
invalid_check_state_list = (\'draft\', \'confirmed\')\n limit_start = int(kw.get(\'list_start\'))\n
limit = limit_start, nb_lines\n
\n \n
simulation_state = None\n simulation_state = None\n
model_filter_dict = {}\n model_filter_dict = {}\n
...@@ -86,6 +84,7 @@ fast_input_type = getattr(request, \'your_fast_input_type\', None)\n ...@@ -86,6 +84,7 @@ fast_input_type = getattr(request, \'your_fast_input_type\', None)\n
if fast_input_type is None:\n if fast_input_type is None:\n
fast_input_type = getattr(request, \'field_your_fast_input_type\')\n fast_input_type = getattr(request, \'field_your_fast_input_type\')\n
\n \n
# retrieve reference field to filter list\n
reference = getattr(request, \'your_reference\', None)\n reference = getattr(request, \'your_reference\', None)\n
if reference is None:\n if reference is None:\n
reference = getattr(request, \'field_your_reference\', None)\n reference = getattr(request, \'field_your_reference\', None)\n
...@@ -120,8 +119,8 @@ listbox = context.Delivery_getCheckbookList(\n ...@@ -120,8 +119,8 @@ listbox = context.Delivery_getCheckbookList(\n
disable_node=disable_node,\n disable_node=disable_node,\n
at_date=at_date,\n at_date=at_date,\n
node=node,\n node=node,\n
reference=reference)\n reference=reference,\n
\n limit=limit)\n
context.Base_updateDialogForm(listbox=listbox)\n context.Base_updateDialogForm(listbox=listbox)\n
\n \n
return context.ListBox_initializeFastInput()\n return context.ListBox_initializeFastInput()\n
...@@ -175,7 +174,6 @@ return context.ListBox_initializeFastInput()\n ...@@ -175,7 +174,6 @@ return context.ListBox_initializeFastInput()\n
<tuple> <tuple>
<string>args</string> <string>args</string>
<string>kw</string> <string>kw</string>
<string>DateTime</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
...@@ -183,10 +181,10 @@ return context.ListBox_initializeFastInput()\n ...@@ -183,10 +181,10 @@ return context.ListBox_initializeFastInput()\n
<string>node</string> <string>node</string>
<string>None</string> <string>None</string>
<string>destination_payment</string> <string>destination_payment</string>
<string>reference_date</string> <string>int</string>
<string>item_list</string> <string>nb_lines</string>
<string>listbox</string> <string>limit_start</string>
<string>invalid_check_state_list</string> <string>limit</string>
<string>simulation_state</string> <string>simulation_state</string>
<string>model_filter_dict</string> <string>model_filter_dict</string>
<string>getattr</string> <string>getattr</string>
...@@ -195,6 +193,7 @@ return context.ListBox_initializeFastInput()\n ...@@ -195,6 +193,7 @@ return context.ListBox_initializeFastInput()\n
<string>disable_node</string> <string>disable_node</string>
<string>at_date</string> <string>at_date</string>
<string>_write_</string> <string>_write_</string>
<string>listbox</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
426 428
\ No newline at end of file \ 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