From f0d4abf529c2420a655ecdd0432272d779f59b87 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Fri, 1 Dec 2006 14:38:28 +0000 Subject: [PATCH] add many more checks with the counter date when we open and close it. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11578 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../Baobab_checkRemainingOperation.xml | 225 ++++++++++++++++ .../Baobab_checkStockBeforeClosingDate.xml | 255 ++++++++++++++++++ .../CounterModule_getVaultTransactionList.xml | 8 +- .../Preference_viewBanking.xml | 128 +++++++++ ...eferred_usual_cash_max_rendering_price.xml | 254 +++++++++++++++++ .../scripts/closeAllCounter.xml | 6 + .../scripts/openAllCounter.xml | 38 ++- bt5/erp5_banking_core/bt/change_log | 3 + bt5/erp5_banking_core/bt/revision | 2 +- 9 files changed, 903 insertions(+), 16 deletions(-) create mode 100644 bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkRemainingOperation.xml create mode 100644 bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkStockBeforeClosingDate.xml create mode 100644 bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Preference_viewBanking.xml create mode 100644 bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Preference_viewBanking/my_preferred_usual_cash_max_rendering_price.xml diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkRemainingOperation.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkRemainingOperation.xml new file mode 100644 index 0000000000..f810ec6315 --- /dev/null +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkRemainingOperation.xml @@ -0,0 +1,225 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PythonScripts.PythonScript</string> + <string>PythonScript</string> + </tuple> + <none/> + </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># Make sure there is not any operation wich is not finished yet\n +# This is usefull when we close a counter date\n +\n +not_closed_state_list = (\'ordered\',\'planned\',\'confirmed\',\'started\',\'stopped\')\n +if site is None:\n + root_site_url = context.Baobab_getUserAssignedRootSiteList()[0]\n + site = context.portal_categories.restrictedTraverse(root_site_url)\n +root_site_uid = site.getUid()\n +document_list = [x.getObject() for x in context.portal_catalog(\n + simulation_state=not_closed_state_list,\n + source_uid=root_site_uid)]\n +document_list.extend([x.getObject() for x in context.portal_catalog(\n + simulation_state=not_closed_state_list,\n + destination_uid=root_site_uid)])\n +for document in document_list:\n + # Cash movement in ordered stated are allowed\n + if document.getPortalType() in (\'Cash Movement\',):\n + if document.getSimulationState()==\'planned\':\n + continue\n + from Products.ERP5Type.Message import Message\n + from Products.DCWorkflow.DCWorkflow import ValidationFailed\n + portal_type = document.getTranslatedPortalType()\n + reference = document.getReference()\n + if reference is None:\n + reference = Message(domain=\'ui\',message=\'Not defined\')\n + message = Message(domain="ui", \n + message="Sorry, the $portal_type (reference:$reference) is not finished",\n + mapping={\'portal_type\':portal_type,\'reference\':reference})\n + raise ValidationFailed,message\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_dav_writelocks</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </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>site=None</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>site</string> + <string>not_closed_state_list</string> + <string>None</string> + <string>_getitem_</string> + <string>_getattr_</string> + <string>context</string> + <string>root_site_url</string> + <string>root_site_uid</string> + <string>append</string> + <string>$append0</string> + <string>_getiter_</string> + <string>x</string> + <string>document_list</string> + <string>document</string> + <string>Products.ERP5Type.Message</string> + <string>Message</string> + <string>Products.DCWorkflow.DCWorkflow</string> + <string>ValidationFailed</string> + <string>portal_type</string> + <string>reference</string> + <string>message</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <none/> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Baobab_checkRemainingOperation</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <tuple> + <string>Persistence</string> + <string>PersistentMapping</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_container</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> 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 new file mode 100644 index 0000000000..8ee6e53821 --- /dev/null +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkStockBeforeClosingDate.xml @@ -0,0 +1,255 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PythonScripts.PythonScript</string> + <string>PythonScript</string> + </tuple> + <none/> + </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[ + +# Make sure that there is no stock on counters and that there\n +# is not too much money into the usual cash\n +# This is usefull when we close a counter date\n +\n +from Products.ERP5Type.Message import Message\n +from Products.DCWorkflow.DCWorkflow import ValidationFailed\n +\n +if site is None:\n + root_site_url = context.Baobab_getUserAssignedRootSiteList()[0]\n + site = context.portal_categories.restrictedTraverse(root_site_url)\n +\n +resource_uid_list = [x.uid for x in context.currency_cash_module.searchFolder()]\n +\n +\n +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 +for counter_vault in counter_vault_list:\n + counter_vault_url = counter_vault[1]\n + if counter_vault_url==\'\':\n + continue\n + counter_title = counter_vault[0]\n + inventory_list = context.portal_simulation.getCurrentInventoryList(\n + node=counter_vault_url,\n + resource_uid=resource_uid_list,\n + ignore_variation=0)\n + if len(inventory_list)>0:\n + message = Message(domain=\'ui\',\n + message=\'Sorry, some resources are still remaining here : $counter_title\',\n + mapping={\'counter_title\':counter_title})\n + raise ValidationFailed,message\n +\n +max_price = context.portal_preferences.getPreferredUsualCashMaxRenderingPrice()\n +if max_price is None:\n + message = Message(domain=\'ui\',\n + message=\'Sorry, you must defined the max price for the usual cash in your preference\')\n + raise ValidationFailed,message\n +\n +usual_cash = site.getRelativeUrl() + \'/surface/caisse_courante/encaisse_des_billets_et_monnaies\'\n +inventory_list = context.portal_simulation.getCurrentInventoryList(\n + node=usual_cash,\n + resource_uid=resource_uid_list)\n +total_price = sum([x.total_price for x in inventory_list])\n +context.log(\'current_price\',total_price)\n +\n +if total_price > max_price:\n + message = Message(domain=\'ui\',\n + message=\'Sorry, the amount in the usual cash is too high\')\n + raise ValidationFailed,message\n + + +]]></string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_dav_writelocks</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </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>site=None</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>site</string> + <string>Products.ERP5Type.Message</string> + <string>Message</string> + <string>Products.DCWorkflow.DCWorkflow</string> + <string>ValidationFailed</string> + <string>None</string> + <string>_getitem_</string> + <string>_getattr_</string> + <string>context</string> + <string>root_site_url</string> + <string>append</string> + <string>$append0</string> + <string>_getiter_</string> + <string>x</string> + <string>resource_uid_list</string> + <string>counter_vault_list</string> + <string>counter_vault</string> + <string>counter_vault_url</string> + <string>counter_title</string> + <string>inventory_list</string> + <string>len</string> + <string>message</string> + <string>max_price</string> + <string>usual_cash</string> + <string>sum</string> + <string>total_price</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <none/> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Baobab_checkStockBeforeClosingDate</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <tuple> + <string>Persistence</string> + <string>PersistentMapping</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_container</string> </key> + <value> + <dictionary/> + </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 ee9799152c..7de6291576 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 @@ -145,10 +145,10 @@ vault_inventory_list = context.portal_simulation.getCurrentInventoryList( node=v , ignore_variation=0\n ,**inventory_kw\n )\n -context.log(\'CounterMOdule_getVaultTransactionList, sql src:\',context.portal_simulation.getCurrentInventoryList( node=vault\n - , ignore_variation=0,src__=1\n - ,**inventory_kw\n - ))\n +#context.log(\'CounterMOdule_getVaultTransactionList, sql src:\',context.portal_simulation.getCurrentInventoryList( node=vault\n +# , ignore_variation=0,src__=1\n +# ,**inventory_kw\n +# ))\n \n #context.log(\'len(vault_inventory_list:\',len(vault_inventory_list))\n for vault_inventory in vault_inventory_list:\n diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Preference_viewBanking.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Preference_viewBanking.xml new file mode 100644 index 0000000000..25c6dc07bc --- /dev/null +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Preference_viewBanking.xml @@ -0,0 +1,128 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.ERP5Form.Form</string> + <string>ERP5Form</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <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/> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>action</string> </key> + <value> <string>Base_edit</string> </value> + </item> + <item> + <key> <string>encoding</string> </key> + <value> <string>UTF-8</string> </value> + </item> + <item> + <key> <string>enctype</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>group_list</string> </key> + <value> + <list> + <string>left</string> + </list> + </value> + </item> + <item> + <key> <string>groups</string> </key> + <value> + <dictionary> + <item> + <key> <string>left</string> </key> + <value> + <list> + <string>my_preferred_usual_cash_max_rendering_price</string> + </list> + </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Preference_viewBanking</string> </value> + </item> + <item> + <key> <string>method</string> </key> + <value> <string>POST</string> </value> + </item> + <item> + <key> <string>name</string> </key> + <value> <string>Preference_viewBanking</string> </value> + </item> + <item> + <key> <string>pt</string> </key> + <value> <string>form_view</string> </value> + </item> + <item> + <key> <string>row_length</string> </key> + <value> <int>4</int> </value> + </item> + <item> + <key> <string>stored_encoding</string> </key> + <value> <string>UTF-8</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Banking Preference</string> </value> + </item> + <item> + <key> <string>unicode_mode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>update_action</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Preference_viewBanking/my_preferred_usual_cash_max_rendering_price.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Preference_viewBanking/my_preferred_usual_cash_max_rendering_price.xml new file mode 100644 index 0000000000..8df11ac89c --- /dev/null +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Preference_viewBanking/my_preferred_usual_cash_max_rendering_price.xml @@ -0,0 +1,254 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.Formulator.StandardFields</string> + <string>FloatField</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_preferred_usual_cash_max_rendering_price</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>not_float</string> </key> + <value> <string>You did not enter a floating point number.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input 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>input_style</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>precision</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>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> <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>input_style</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>precision</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>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>20</int> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</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>input_style</string> </key> + <value> <string>-1 234.5</string> </value> + </item> + <item> + <key> <string>precision</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Usual Cash Max Rendering Price</string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/closeAllCounter.xml b/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/closeAllCounter.xml index 9e54c268f3..c822ab5715 100644 --- a/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/closeAllCounter.xml +++ b/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/closeAllCounter.xml @@ -83,6 +83,12 @@ while True:\n break\n site = site.getParentValue()\n \n +# First make sure there is nothing any more on counters\n +transaction.Baobab_checkStockBeforeClosingDate(site=site)\n +\n +# Then make sure there is not any pending operation\n +transaction.Baobab_checkRemainingOperation(site=site)\n +\n current_date = transaction.getStartDate()\n counter_list = [x.getObject() for x in context.portal_catalog(portal_type="Counter", simulation_state = [\'open\', \'closing\'], site_uid = site.getUid())]\n \n diff --git a/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/openAllCounter.xml b/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/openAllCounter.xml index 31a82c7b7c..33b8eb88ef 100644 --- a/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/openAllCounter.xml +++ b/bt5/erp5_banking_core/WorkflowTemplateItem/portal_workflow/counter_date_workflow/scripts/openAllCounter.xml @@ -70,12 +70,20 @@ <key> <string>_body</string> </key> <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ERP5Type.Message import Message\n +counter_date = state_change[\'object\']\n \n -listbox = state_change.kwargs.get(\'listbox\')\n +# First, make sure there is not any counter date open for this site\n +site_uid = context.getSiteUid()\n +counter_date_list = [x.getObject() for x in context.portal_catalog(portal_type=\'Counter Date\',site_uid=site_uid,simulation_state=\'open\')]\n +for other_counter in counter_date_list:\n + if other_counter.getUid()!=counter_date.getUid():\n + msg = Message(domain=\'ui\',message="Sorry, there is already a counter date opened")\n + raise ValidationFailed (msg,)\n + \n +listbox = state_change.kwargs.get(\'listbox\',None)\n \n # First make sure we can open a counter date only\n # if the date defined on the document is the current date\n -counter_date = state_change[\'object\']\n start_date = counter_date.getStartDate()\n from DateTime import DateTime\n now = DateTime()\n @@ -84,10 +92,11 @@ if now.Date() != start_date.Date():\n msg = Message(domain=\'ui\',message="Sorry, the date is not today")\n raise ValidationFailed (msg,)\n \n -for line in listbox:\n - if line["choice"] == "open":\n - counter = context.restrictedTraverse("%s" %(line[\'listbox_key\'],))\n - counter.open()\n +if listbox is not None:\n + for line in listbox:\n + if line["choice"] == "open":\n + counter = context.restrictedTraverse("%s" %(line[\'listbox_key\'],))\n + counter.open()\n </string> </value> </item> <item> @@ -143,17 +152,24 @@ for line in listbox:\n <string>ValidationFailed</string> <string>Products.ERP5Type.Message</string> <string>Message</string> - <string>_getattr_</string> - <string>listbox</string> <string>_getitem_</string> <string>counter_date</string> + <string>_getattr_</string> + <string>context</string> + <string>site_uid</string> + <string>append</string> + <string>$append0</string> + <string>_getiter_</string> + <string>x</string> + <string>counter_date_list</string> + <string>other_counter</string> + <string>msg</string> + <string>None</string> + <string>listbox</string> <string>start_date</string> <string>DateTime</string> <string>now</string> - <string>msg</string> - <string>_getiter_</string> <string>line</string> - <string>context</string> <string>counter</string> </tuple> </value> diff --git a/bt5/erp5_banking_core/bt/change_log b/bt5/erp5_banking_core/bt/change_log index 7e9ca60aec..eb92edf76f 100644 --- a/bt5/erp5_banking_core/bt/change_log +++ b/bt5/erp5_banking_core/bt/change_log @@ -1,3 +1,6 @@ +2006-12-01 Seb +* add many more checks with the counter date when we open and close it. + 2006-11-30 aurel * fix z_catalog_item_list diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision index 3d9aebb2cc..9cd72aa941 100644 --- a/bt5/erp5_banking_core/bt/revision +++ b/bt5/erp5_banking_core/bt/revision @@ -1 +1 @@ -68 \ No newline at end of file +72 \ No newline at end of file -- 2.30.9