diff --git a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkCheck.xml b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkCheck.xml index de35974fc676e3d46ee48cbe9ff63cf5d7b5e3db..bcbf4bfef96bc4ce1ac1bdc54d7348a69f6769e5 100644 --- a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkCheck.xml +++ b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/Base_checkCheck.xml @@ -69,7 +69,8 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n \n # Check that a check exists for given bank account and reference.\n -check = context.Base_checkOrCreateCheck(reference=reference, \n +if check is None:\n + check = context.Base_checkOrCreateCheck(reference=reference, \n bank_account=bank_account,\n resource=resource)\n \n @@ -109,7 +110,7 @@ return check\n </item> <item> <key> <string>_params</string> </key> - <value> <string>bank_account, reference, resource</string> </value> + <value> <string>bank_account, reference, resource, check=None</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -129,7 +130,7 @@ return check\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>3</int> </value> + <value> <int>4</int> </value> </item> <item> <key> <string>co_varnames</string> </key> @@ -138,13 +139,14 @@ return check\n <string>bank_account</string> <string>reference</string> <string>resource</string> + <string>check</string> <string>Products.ERP5Type.Message</string> <string>Message</string> <string>Products.DCWorkflow.DCWorkflow</string> <string>ValidationFailed</string> + <string>None</string> <string>_getattr_</string> <string>context</string> - <string>check</string> <string>bad_simulation_state_dict</string> <string>simulation_state</string> <string>_getitem_</string> @@ -160,7 +162,9 @@ return check\n <item> <key> <string>func_defaults</string> </key> <value> - <none/> + <tuple> + <none/> + </tuple> </value> </item> <item> diff --git a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml index 4f3c4d01754494073185f78ea431e98b575d639d..7198f0f0f4a49c77a60b535911d326230d5b571d 100644 --- a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml +++ b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/scripts/validateConsistency.xml @@ -139,6 +139,20 @@ check = transaction.Base_checkCheck(reference=check_number, bank_account=bank_ac transaction.edit(aggregate=check.getRelativeUrl())\n \n context.updateBankingOperation(state_change)\n +\n +# Test if the account balance is sufficient.\n +# We do not need to serialize here because we do not make\n +# reservation yet\n +error = transaction.BankAccount_checkAvailableBalance(bank_account.getRelativeUrl(), price)\n +if error[\'error_code\'] == 1:\n + msg = Message(domain=\'ui\', message="Bank account is not sufficient.")\n + raise ValidationFailed, (msg,)\n +elif error[\'error_code\'] == 2:\n + msg = Message(domain=\'ui\', message="Bank account is not valid.")\n + raise ValidationFailed, (msg,)\n +elif error[\'error_code\'] != 0:\n + msg = Message(domain=\'ui\', message="Unknown error code.")\n + raise ValidationFailed, (msg,)\n ]]></string> </value> @@ -216,6 +230,7 @@ context.updateBankingOperation(state_change)\n <string>check_resource</string> <string>check</string> <string>context</string> + <string>error</string> </tuple> </value> </item> diff --git a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/states/draft.xml b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/states/draft.xml index 19c3f1b3b786949fda40d60202d1988b1c5782e2..682ee9075269a3ff7098444c9814d25d5a3e362e 100644 --- a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/states/draft.xml +++ b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/states/draft.xml @@ -41,6 +41,8 @@ <string>cancel_action</string> <string>delete</string> <string>delete_action</string> + <string>order</string> + <string>order_action</string> <string>plan</string> <string>plan_action</string> </tuple> diff --git a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/states/planned.xml b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/states/planned.xml index aa80921254efaa86cdc91e62d8db626b84bd7349..4c85516ffc5c3a046ce55b11c2200be687144acd 100644 --- a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/states/planned.xml +++ b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/states/planned.xml @@ -86,7 +86,6 @@ <key> <string>Add portal content</string> </key> <value> <tuple> - <string>Assignee</string> <string>Manager</string> </tuple> </value> @@ -95,7 +94,6 @@ <key> <string>Modify portal content</string> </key> <value> <tuple> - <string>Assignee</string> <string>Manager</string> </tuple> </value> diff --git a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/order_action.xml b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/order_action.xml index 9f1abca9a20298869c054346588ee4a198093eef..5d0e9d7bfb338821e111f1529242d049783d7f43 100644 --- a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/order_action.xml +++ b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/order_action.xml @@ -79,6 +79,7 @@ <tuple> <string>Manager</string> <string>Assignee</string> + <string>Assignor</string> </tuple> </value> </item> diff --git a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/plan_action.xml b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/plan_action.xml index e6c6b687f83780fb506974ef0dead0c4f8d3c82d..9fc1b72830f0f8fc2669dad08d6e6616d598053c 100644 --- a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/plan_action.xml +++ b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/check_payment_workflow/transitions/plan_action.xml @@ -21,7 +21,7 @@ </item> <item> <key> <string>actbox_name</string> </key> - <value> <string>Check Consistency</string> </value> + <value> <string>Send to Validation</string> </value> </item> <item> <key> <string>actbox_url</string> </key> diff --git a/bt5/erp5_banking_check/bt/revision b/bt5/erp5_banking_check/bt/revision index f64b48379f00dff32d5bcccd67c0d82c2249eb86..fc72547e33638e38bf14b4f33418739eef2dcd3a 100644 --- a/bt5/erp5_banking_check/bt/revision +++ b/bt5/erp5_banking_check/bt/revision @@ -1 +1 @@ -343 \ No newline at end of file +344 \ No newline at end of file