From 5bf2de469c7fab6f719e012f5acb1c74afb5c843 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Fri, 9 Mar 2007 15:24:11 +0000 Subject: [PATCH] Remove hardcoded date for automatic check creation and create a generic script (then locally overridable) to do the actual choice. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13309 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../Base_checkOrCreateCheck.xml | 9 +- .../Base_isAutomaticCheckCreationAllowed.xml | 155 ++++++++++++++++++ bt5/erp5_banking_check/bt/revision | 2 +- 3 files changed, 157 insertions(+), 9 deletions(-) create mode 100644 bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_isAutomaticCheckCreationAllowed.xml diff --git a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkOrCreateCheck.xml b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkOrCreateCheck.xml index d1da5563da..0d2d4574fc 100644 --- a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkOrCreateCheck.xml +++ b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkOrCreateCheck.xml @@ -76,7 +76,6 @@ # 2 - if the end date is passed, we raise an error\n from Products.ERP5Type.Message import Message\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n -from DateTime import DateTime\n \n if destination:\n bank_account = context.getDestinationPaymentValue()\n @@ -125,10 +124,7 @@ for check_reference in reference_list:\n raise ValidationFailed, (msg,)\n result = context.portal_catalog(portal_type = \'Check\', reference = check_reference)\n if len(result) == 0:\n - # We will not allow creation of generic check after a particular date\n - end_date = DateTime(\'2009/01/01\')\n - now = DateTime()\n - if (now - end_date) >0:\n + if not context.Base_isAutomaticCheckCreationAllowed():\n msg = Message(domain = "ui", message="Sorry, this reference does not exist")\n raise ValidationFailed, (msg,)\n \n @@ -222,7 +218,6 @@ return check_list\n <string>Message</string> <string>Products.DCWorkflow.DCWorkflow</string> <string>ValidationFailed</string> - <string>DateTime</string> <string>_getattr_</string> <string>context</string> <string>bank_account</string> @@ -239,8 +234,6 @@ return check_list\n <string>message_tag</string> <string>result</string> <string>len</string> - <string>end_date</string> - <string>now</string> <string>checkbook</string> <string>_getitem_</string> <string>generic_model</string> diff --git a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_isAutomaticCheckCreationAllowed.xml b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_isAutomaticCheckCreationAllowed.xml new file mode 100644 index 0000000000..0b43598adf --- /dev/null +++ b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_isAutomaticCheckCreationAllowed.xml @@ -0,0 +1,155 @@ +<?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># This script must be overloaded to allow automatic creation of checks.\n +# A use case for this functionnality is to cover the transition time between\n +# initial site installation and the time all processed checks a re supposed\n +# to be known to the system beforehand, ie emitted during the site lifespan.\n +\n +# Return True is the creation is allowed.\n +# Return False otherwise.\n +return False\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></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>False</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>Base_isAutomaticCheckCreationAllowed</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_banking_check/bt/revision b/bt5/erp5_banking_check/bt/revision index 69226f7293..c4fbb1cfac 100644 --- a/bt5/erp5_banking_check/bt/revision +++ b/bt5/erp5_banking_check/bt/revision @@ -1 +1 @@ -92 \ No newline at end of file +97 \ No newline at end of file -- 2.30.9