diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkStockBeforeClosingDate.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkStockBeforeClosingDate.xml index 58649fa30ae2dbf8806c07b897360725b3bfe47d..6cc5a2761774ebcf0e0cfeb821f2155ec8c5e088 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkStockBeforeClosingDate.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkStockBeforeClosingDate.xml @@ -85,7 +85,8 @@ counter_vault_list = context.Delivery_getVaultItemList(\n user_site=0,base_site=site.getRelativeUrl(),all=1,\n vault_type=(\'site/surface/banque_interne\',\'site/surface/gros_paiement\',\n \'site/surface/gros_versement\',\'site/surface/operations_diverses\',\n - \'site/surface/salle_tri\'))\n + \'site/surface/salle_tri\',\n + \'site/surface/caisse_courante/encaisse_des_devises\'))\n for counter_vault in counter_vault_list:\n counter_vault_url = counter_vault[1]\n if counter_vault_url==\'\':\n diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_sortCurrencyCashList.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_sortCurrencyCashList.xml index 379954bb63d59323bc1f24f395aad58595026da8..903cac79e1badc6bddf08c095f44947e2802b7ce 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_sortCurrencyCashList.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Base_sortCurrencyCashList.xml @@ -79,13 +79,13 @@ a = a_source.getResourceValue()\n b = b_source.getResourceValue()\n \n - # First, compare the base prices (such as 1000 and 2000 Francs CFA).\n - result = - cmp(a.getBasePrice(), b.getBasePrice())\n + # Second, compare the portal types.\n + result = cmp(a.getPortalType(), b.getPortalType())\n if result != 0:\n return result\n \n - # Second, compare the portal types.\n - result = cmp(a.getPortalType(), b.getPortalType())\n + # First, compare the base prices (such as 1000 and 2000 Francs CFA).\n + result = - cmp(a.getBasePrice(), b.getBasePrice())\n if result != 0:\n return result\n \n diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_generateCashDetailInputDialog.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_generateCashDetailInputDialog.xml index 8dea0791d66c6aba769930d23968dbff44a7365c..8c9d579d6e959ee6890f4e1ed8ff6acdd3397e69 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_generateCashDetailInputDialog.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_generateCashDetailInputDialog.xml @@ -71,6 +71,9 @@ # when the user clicks on the Update button, listbox is passed, and\n # the contents must be preserved in the form.\n \n +from Products.ERP5Type.Cache import CachingMethod\n +portal = context.getPortalObject()\n +\n if listbox is None:\n # This is the first time.\n cash_status_list = cash_detail_dict[\'cash_status_list\']\n @@ -140,9 +143,27 @@ if listbox is None:\n \n # Get the currency cash objects for a given currency.\n currency = \'currency_module/%s\' % operation_currency\n - result = context.portal_catalog(portal_type = currency_cash_portal_type)\n - currency_cash_list = [x.getObject() for x in result if x.getObject().getPriceCurrency() == currency and len(x.getObject().getVariationList())>0]\n - #context.log(\'CashDelivery_generateCashDetailInputDialog\', \'currency_list = %r, operation_cur = %s\' % (currency_cash_list, operation_currency))\n + # This is very bad to call catalog each time, it is the bottleneck,\n + # So we will add a caching method here\n + def getCurrencyCashRelativeUrlList(currency=None, currency_cash_portal_type=None):\n + result = context.portal_catalog(portal_type = currency_cash_portal_type)\n + currency_cash_list = [x.getObject() for x in result \n + if x.getObject().getPriceCurrency() == currency \n + and len(x.getObject().getVariationList())>0]\n + return [x.getRelativeUrl() for x in currency_cash_list]\n + getCurrencyCashRelativeUrlList = CachingMethod(getCurrencyCashRelativeUrlList, \n + id=(\'CashDelivery_generateCashDetailInputDialog\', \n + \'getCurrencyCashRelativeUrlList\'), \n + cache_factory=\'erp5_ui_long\')\n + currency_cash_url_list = getCurrencyCashRelativeUrlList(currency=currency,\n + currency_cash_portal_type=currency_cash_portal_type)\n + currency_cash_list = [portal.restrictedTraverse(x) for x in currency_cash_url_list]\n +\n + # This is the same thing, but by using catalog, so this is not nice at all\n + #result = context.portal_catalog(portal_type = currency_cash_portal_type)\n + #currency_cash_list = [x.getObject() for x in result if x.getObject().getPriceCurrency() == currency and len(x.getObject().getVariationList())>0]\n +\n + context.log(\'CashDelivery_generateCashDetailInputDialog\', \'currency_list = %r, operation_cur = %s\' % ([x.getTitle() for x in currency_cash_list], operation_currency))\n \n # If only one variation is specified, we want to display a part of cash currencies which\n # exists in this variation (creation year, such as 2003).\n @@ -155,6 +176,7 @@ if listbox is None:\n currency_cash_list = new_currency_cash_list\n \n currency_cash_list = context.Base_sortCurrencyCashList(currency_cash_list)\n + context.log(\'CashDelivery_generateCashDetailInputDialog after sort\', \'currency_list = %r, operation_cur = %s\' % ([x.getTitle() for x in currency_cash_list], operation_currency))\n \n # Get the axis information based on the specified column base category.\n # axis_list_dict contains the lists of objects, while axis_dict contains\n @@ -290,6 +312,7 @@ if listbox is None:\n currency_dict[\'column%d\' % (counter + 1)] = 0\n listbox.append(currency_dict)\n \n + context.log(\'generateFastInput, listbox\',listbox)\n other_parameter_list = (operation_currency, line_portal_type, read_only, column_base_category, use_inventory)\n context.Base_updateDialogForm(listbox=listbox\n , calculated_price=total_price\n @@ -355,9 +378,13 @@ else :\n for line in listbox:\n # must get the resource\n resource_id = line[\'resource_id\']\n - resource_list = context.portal_catalog(portal_type = (\'Banknote\',\'Coin\') ,id = resource_id)\n - resource_price = resource_list[0].getObject().getBasePrice()\n - line[\'resource_translated_title\'] = resource_list[0].getObject().getTranslatedTitle()\n + # This is a huge performance problem to call many times the catalog\n + # for each fast input !!!!\n + #resource_list = context.portal_catalog(portal_type = (\'Banknote\',\'Coin\') ,id = resource_id)\n + #resource_price = resource_list[0].getObject().getBasePrice()\n + resource_value = context.currency_cash_module[resource_id]\n + resource_price = resource_value.getObject().getBasePrice()\n + line[\'resource_translated_title\'] = resource_value.getTranslatedTitle()\n # get the number of lines to add\n if line.has_key(\'number_line_to_add\'):\n lines_to_add = int(line[\'number_line_to_add\'])\n @@ -452,6 +479,11 @@ else :\n <string>listbox</string> <string>cash_detail_dict</string> <string>kw</string> + <string>Products.ERP5Type.Cache</string> + <string>CachingMethod</string> + <string>_getattr_</string> + <string>context</string> + <string>portal</string> <string>None</string> <string>_getitem_</string> <string>cash_status_list</string> @@ -465,8 +497,6 @@ else :\n <string>False</string> <string>use_inventory</string> <string>list</string> - <string>_getattr_</string> - <string>context</string> <string>generic_prioritized_sort</string> <string>prioritized_banknote_emission_letter_list</string> <string>prioritized_coin_cash_status_list</string> @@ -483,9 +513,10 @@ else :\n <string>banknote_emission_letter_list</string> <string>coin_emission_letter_list</string> <string>currency</string> - <string>result</string> - <string>len</string> + <string>getCurrencyCashRelativeUrlList</string> + <string>currency_cash_url_list</string> <string>currency_cash_list</string> + <string>len</string> <string>new_currency_cash_list</string> <string>variation</string> <string>currency_cash</string> @@ -527,7 +558,7 @@ else :\n <string>int</string> <string>next_listbox_key</string> <string>resource_id</string> - <string>resource_list</string> + <string>resource_value</string> <string>lines_to_add</string> <string>xrange</string> <string>num</string> diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList.xml index ea4bd0940e8749d4e0286167af429dc6939e763c..c743d8a974a543f79d1154232dcacbdca2f50f90 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList.xml @@ -78,6 +78,7 @@ <value> <list> <string>listbox</string> + <string>listbox_destination_payment_internal_bank_account_number</string> </list> </value> </item> diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList/listbox.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList/listbox.xml index ec81670ac2a505fb403aede310f1f44a528e37f7..72fcb2404495036339150b846c3584b7cff0c4f8 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList/listbox.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList/listbox.xml @@ -345,7 +345,7 @@ <string>Title</string> </tuple> <tuple> - <string>destination_payment_reference</string> + <string>destination_payment_internal_bank_account_number</string> <string>Account</string> </tuple> <tuple> @@ -402,7 +402,12 @@ <item> <key> <string>editable_columns</string> </key> <value> - <list/> + <list> + <tuple> + <string>destination_payment_internal_bank_account_number</string> + <string>destination_payment_internal_bank_account_number</string> + </tuple> + </list> </value> </item> <item> diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList/listbox_destination_payment_internal_bank_account_number.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList/listbox_destination_payment_internal_bank_account_number.xml new file mode 100644 index 0000000000000000000000000000000000000000..64711c3ca749c5616fd9bbc711c0edb1aaede228 --- /dev/null +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CheckbookModule_viewCheckbookList/listbox_destination_payment_internal_bank_account_number.xml @@ -0,0 +1,287 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="StringField" module="Products.Formulator.StandardFields"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>listbox_destination_payment_internal_bank_account_number</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>Too much input was given.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <int>12</int> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Account Number</string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: cell.getDestinationPaymentValue().getInternalBankAccountNumber()</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterModule_getVaultTransactionList.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterModule_getVaultTransactionList.xml index 79f4dfba9f4af262f7523b2714c5eec7edc942dc..73cb434c0ff23529a8ac28fa281481d68727d126 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterModule_getVaultTransactionList.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterModule_getVaultTransactionList.xml @@ -73,6 +73,10 @@ \n from Products.ERP5Type.Document import newTempBase\n \n +if from_date is not None:\n + if from_date == at_date:\n + from_date=None\n +\n #context.log(\'CounterModule_getVaultTransactionList vault:\',vault)\n def getTranslatedTitleFromCategoryUrl(category):\n return context.portal_categories.getCategoryValue(category).getTranslatedTitle()\n @@ -346,6 +350,7 @@ return repr([x for x in total_inventory_list])\n <string>kw</string> <string>Products.ERP5Type.Document</string> <string>newTempBase</string> + <string>None</string> <string>getTranslatedTitleFromCategoryUrl</string> <string>getTitleFromCategoryUrl</string> <string>getVariationTitleList</string> @@ -362,7 +367,6 @@ return repr([x for x in total_inventory_list])\n <string>_write_</string> <string>total_inventory_list</string> <string>inventory_kw</string> - <string>None</string> <string>_getitem_</string> <string>len</string> <string>kw_has_cash_status</string> diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Delivery_getVaultItemList.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Delivery_getVaultItemList.xml index a8f23398669275adb62054969c09b901939e127d..a64d568720bffbe31c390923233d304729d37626 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Delivery_getVaultItemList.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Delivery_getVaultItemList.xml @@ -97,7 +97,7 @@ from Products.ERP5Type.Cache import CachingMethod\n def getVaultItemList(vault_type=None, exclude_vault_type=None,\n user_site=1, leaf_node=1, strict_membership=0, assignment_list=None,\n site_list=None, with_base=1, all=0, first_level=0,main_agency=0,\n - exclude_site_list=None):\n + exclude_site_list=None,mode_test=0):\n \n if vault_type is None:\n organisation_list = []\n @@ -184,11 +184,6 @@ def getVaultItemList(vault_type=None, exclude_vault_type=None,\n vault_dict = {}\n # Transform each line of the vault list\n keep_level = []\n - erp5_site = context.getPortalObject()\n - mode_test = 0\n - if hasattr(erp5_site, \'functionnal_test_mode\'):\n - if getattr(erp5_site, \'functionnal_test_mode\') == 1:\n - mode_test = 1\n for vault_item in vault_list:\n # do not include testsite if not in test mode\n if mode_test == 0 and \'testsite\' in vault_item[1]:\n @@ -224,6 +219,12 @@ if vault_type is None:\n else:\n assignment_list = None\n \n +erp5_site = context.getPortalObject()\n +mode_test = 0\n +if hasattr(erp5_site, \'functionnal_test_mode\'):\n + if getattr(erp5_site, \'functionnal_test_mode\') == 1:\n + mode_test = 1\n +\n user_site_list = []\n if user_site == 1 or owner_site==1:\n if owner_site:\n @@ -260,7 +261,8 @@ if exclude_user_site:\n vault_list = getVaultItemList(vault_type=vault_type, exclude_vault_type=exclude_vault_type,\n user_site=user_site, leaf_node=leaf_node, strict_membership=strict_membership,\n assignment_list=assignment_list, site_list=site_list, with_base=with_base, all=all,\n - first_level=first_level,main_agency=main_agency,exclude_site_list=exclude_site_list)\n + first_level=first_level,main_agency=main_agency,exclude_site_list=exclude_site_list,\n + mode_test=mode_test)\n \n if user_vault == 1:\n if len(user_site_list)==0:\n @@ -366,6 +368,10 @@ return [(\'\', \'\')] + list(vault_list)\n <string>_getattr_</string> <string>context</string> <string>assignment_list</string> + <string>erp5_site</string> + <string>mode_test</string> + <string>hasattr</string> + <string>getattr</string> <string>user_site_list</string> <string>_getitem_</string> <string>new_site_list</string> diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ListBox_initializeFastInput.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ListBox_initializeFastInput.xml new file mode 100644 index 0000000000000000000000000000000000000000..78aee37e7a99be6c0e246bc2b5af155195eac892 --- /dev/null +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ListBox_initializeFastInput.xml @@ -0,0 +1,259 @@ +<?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 encoding="cdata"><![CDATA[ + +from Products.ERP5Type.Document import newTempBase\n +from string import zfill\n +\n +\n +request = context.REQUEST\n +\n +# It must be possible to initialise the fast input, and to add empty lines after\n +if request.has_key(\'my_empty_line_number\'):\n + empty_line_number = request[\'my_empty_line_number\']\n +\n +\n +l = []\n +first_empty_line_id = 1\n +portal_object = context.getPortalObject()\n +int_len = 3\n +\n +def get_fast_input_discriminant(line_id):\n + line = listbox.get(line_id)\n + if line is not None:\n + resource_id = line.get(\'resource_id\')\n + if resource_id is not None:\n + cash_currency = context.currency_cash_module.get(resource_id)\n + if cash_currency is not None and cash_currency.hasBasePrice():\n + return (cash_currency.getPortalType(), -cash_currency.getBasePrice(), line_id) # First sort by base price (desc), then by line id (asc)\n + return line_id\n +\n +def sort_fast_input_lines(x, y):\n + criterion_x = get_fast_input_discriminant(x)\n + criterion_y = get_fast_input_discriminant(y)\n + if criterion_x < criterion_y:\n + return -1\n + elif criterion_x > criterion_y:\n + return 1\n + else:\n + return 0\n +\n +if hasattr(request, \'listbox\'):\n + # initialize the listbox \n + listbox=request[\'listbox\']\n +\n + keys_list = listbox.keys()\n +\n + if keys_list != []:\n + #keys_list.sort(lambda x,y: cmp(int(x),int(y)))\n + keys_list.sort(sort_fast_input_lines)\n + first_empty_line_id = int(keys_list[-1])+1\n +\n + for i in keys_list:\n + o = newTempBase(portal_object, i)\n + o.setUid(\'new_%s\' % zfill(i,int_len))\n +\n + is_empty = 1\n +\n + for key in listbox[i]:\n + value = listbox[i][key]\n + # 0 was added because of checkbox field in some fast input\n + if (value not in [\'\',None,0]) and (key != \'listbox_key\'):\n + is_empty = 0\n + if (request.has_key(\'field_errors\')):\n + is_empty = 0\n + #o.edit(key=listbox[i][key])\n + o.setProperty(key,listbox[i][key])\n +\n + if not is_empty:\n + l.append(o)\n + \n +# add empty lines\n +if not(request.has_key(\'field_errors\')):\n + for i in range(first_empty_line_id,first_empty_line_id+empty_line_number):\n +\n + o = newTempBase(portal_object, str(i))\n + o.setUid(\'new_%s\' % zfill(i,int_len)) \n + # zfill is used here to garantee sort order - XXX - cleaner approach required\n + l.append(o)\n +\n +\n +return l\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>empty_line_number=0, **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>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>empty_line_number</string> + <string>kw</string> + <string>Products.ERP5Type.Document</string> + <string>newTempBase</string> + <string>string</string> + <string>zfill</string> + <string>_getattr_</string> + <string>context</string> + <string>request</string> + <string>_getitem_</string> + <string>l</string> + <string>first_empty_line_id</string> + <string>portal_object</string> + <string>int_len</string> + <string>listbox</string> + <string>get_fast_input_discriminant</string> + <string>sort_fast_input_lines</string> + <string>hasattr</string> + <string>keys_list</string> + <string>int</string> + <string>_getiter_</string> + <string>i</string> + <string>o</string> + <string>is_empty</string> + <string>key</string> + <string>value</string> + <string>None</string> + <string>range</string> + <string>str</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <int>0</int> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ListBox_initializeFastInput</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision index 9754915269eca9a8e68210cbe363f9fa9be817e1..bb81456fa19cded30402e6818c590bde4d91ead9 100644 --- a/bt5/erp5_banking_core/bt/revision +++ b/bt5/erp5_banking_core/bt/revision @@ -1 +1 @@ -259 \ No newline at end of file +262 \ No newline at end of file