diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateBalance.xml index 9d2baeaa683dcc5611a596ad460de17bcdf7849e..d92b3e8129c4c8a40a872e89f38c8dfcbde383ce 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateBalance.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateBalance.xml @@ -79,8 +79,8 @@ resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_ \n # Get price and total_price.\n price = transaction.getSourceTotalAssetPrice()\n -input_cash = transaction.getTotalPrice(deliveryLineType=\'Incoming Cash Sorting Line\')\n -output_cash = transaction.getTotalPrice(deliveryLineType=\'Outgoing Cash Sorting Line\')\n +input_cash = transaction.getTotalPrice(fast=0,portal_type=(\'Incoming Cash Sorting Line\',\'Cash Delivery Cell\'))\n +output_cash = transaction.getTotalPrice(fast=0,portal_type=(\'Outgoing Cash Sorting Line\',\'Cash Delivery Cell\'))\n \n if input_cash != output_cash :\n msg=Message(domain="ui", message="Incoming cash amount is different from outgoing cash amount.")\n diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateSourceAndDestination.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateSourceAndDestination.xml new file mode 100644 index 0000000000000000000000000000000000000000..366cb85cea2846a617960c0bf83c20f17ff43f27 --- /dev/null +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/scripts/validateSourceAndDestination.xml @@ -0,0 +1,154 @@ +<?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>transaction = state_change.object\n +\n +# Check getBaobabSource and getBaobabDestination\n +transaction.Base_checkBaobabSourceAndDestination()\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>state_change, **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>state_change</string> + <string>kw</string> + <string>_getattr_</string> + <string>transaction</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>validateSourceAndDestination</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/transitions/deliver.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/transitions/deliver.xml index 1af33ab1af4bea70470135faaf77af857f080b9f..35125492fc3a0e3e33846e1bd34ff8f2e406bca2 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/transitions/deliver.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_sorting_workflow/transitions/deliver.xml @@ -60,7 +60,7 @@ </item> <item> <key> <string>script_name</string> </key> - <value> <string></string> </value> + <value> <string>validateSourceAndDestination</string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_sale_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_sale_workflow/scripts/validateVaultBalance.xml index d54270de499d9b2793bbf1e7aadb3da3b5fdf9d7..a7775b587f1e313dcf0f7d4a57697daa7e24e421 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_sale_workflow/scripts/validateVaultBalance.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_sale_workflow/scripts/validateVaultBalance.xml @@ -98,8 +98,10 @@ if not transaction.Baobab_checkCounterDateOpen(site=outgoing_source, date=transa resource_one = transaction.CashDelivery_checkCounterInventory(outgoing_source,portal_type=\'Outgoing Cash To Currency Sale Line\')\n \n \n -billetage_entre = transaction.getTotalPrice(deliveryLineType=\'Incoming Cash To Currency Sale Line\')\n -billetage_sorti = transaction.getTotalPrice(deliveryLineType=\'Outgoing Cash To Currency Sale Line\')\n +#billetage_entre = transaction.getTotalPrice(deliveryLineType=\'Incoming Cash To Currency Sale Line\')\n +billetage_entre = transaction.getTotalPrice(portal_type=[\'Incoming Cash To Currency Sale Line\',\'Cash Delivery Cell\'],fast=0)\n +#billetage_sorti = transaction.getTotalPrice(deliveryLineType=\'Outgoing Cash To Currency Sale Line\')\n +billetage_sorti = transaction.getTotalPrice(portal_type=[\'Outgoing Cash To Currency Sale Line\', \'Cash Delivery Cell\'],fast=0)\n \n \n base_price = transaction.getSourceTotalAssetPrice()\n diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionDeliver.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionDeliver.xml index 91fa9afea0b831647f1578c644cc55f6cbe7500a..5ada8465bf22f9a1a05d8903a4534393fe6d3bb9 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionDeliver.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionDeliver.xml @@ -76,7 +76,7 @@ from Products.ERP5Type.Message import Message\n ob = state_change[\'object\']\n state = ob.getSimulationState()\n # only \'siege\' can do this when no pay back\n -if state == "planned":\n +if state == "planned":\n if ob.getTotalPrice(portal_type="Exchanged Mutilated Banknote Line", fast=0) != 0:\n # we must be in \'siege\' and we want to pay back for another site\n if \'siege\' not in ob.getSource() or ob.getSource() == ob.getSourceTrade():\n diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_incident_workflow/scripts/checkConsistency.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_incident_workflow/scripts/checkConsistency.xml index 5848960445fdfacb38d6be01ed3f18470c50c843..c50f5ce08c6c9d7d08ac69316f7075fdada8bf72 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_incident_workflow/scripts/checkConsistency.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_incident_workflow/scripts/checkConsistency.xml @@ -73,8 +73,14 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ERP5Type.Message import Message\n \n txn = state_change[\'object\']\n -in_list = txn.searchFolder(portal_type=\'Incoming Usual Cash Incident Line\')\n -out_list = txn.searchFolder(portal_type=\'Outgoing Usual Cash Incident Line\')\n +in_list = txn.objectValues(portal_type=\'Incoming Usual Cash Incident Line\')\n +out_list = txn.objectValues(portal_type=\'Outgoing Usual Cash Incident Line\')\n +\n +var_type =txn.getIncidentType()\n +var_source_transport =txn.getSourceTransport()\n +if (var_type == \'reception\' and var_source_transport is None):\n + msg = Message(domain = "ui", message="Remote Site not null.")\n + raise ValidationFailed, (msg,)\n \n price = txn.getSourceTotalAssetPrice()\n in_price = txn.getTotalPrice(deliveryLineType=\'Incoming Usual Cash Incident Line\')\n @@ -97,6 +103,12 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p <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> @@ -141,11 +153,14 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p <string>_getattr_</string> <string>in_list</string> <string>out_list</string> + <string>var_type</string> + <string>var_source_transport</string> + <string>None</string> + <string>msg</string> <string>price</string> <string>in_price</string> <string>out_price</string> <string>len</string> - <string>msg</string> </tuple> </value> </item> @@ -173,4 +188,25 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p </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_cash/WorkflowTemplateItem/portal_workflow/usual_cash_rendering_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_rendering_workflow/scripts/validateVaultBalance.xml index 49cb928bcb32a9e407116a752ce558c6e37dacf2..d72af1c8777437d6296dcb2ecf1d213dea347901 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_rendering_workflow/scripts/validateVaultBalance.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_rendering_workflow/scripts/validateVaultBalance.xml @@ -74,9 +74,15 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ERP5Type.Message import Message\n \n transaction = state_change.object\n -\n +date = transaction.getStartDate()\n vault = transaction.getSource()\n vaultDestination = transaction.getDestination()\n +\n +# check we are in an opened accounting day\n +if not transaction.Baobab_checkCounterDateOpen(site=vault, date=date):\n + msg = Message(domain = "ui", message="Counter Date is not opened")\n + raise ValidationFailed, (msg,)\n +\n if \'reserve\' in vault and \'salle_tri\' in vaultDestination:\n msg = Message(domain="ui", message="Cannot transfer ressource to ${destination} from ${source}.",\n mapping={\'source\':transaction.getSourceValue().getParentValue().getTitle(),\n @@ -149,6 +155,7 @@ elif resource <> 0 :\n <string>Message</string> <string>_getattr_</string> <string>transaction</string> + <string>date</string> <string>vault</string> <string>vaultDestination</string> <string>msg</string> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_rendering_workflow/states/confirmed.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_rendering_workflow/states/confirmed.xml index bb62817ec67c98719dcde2252e9a944d2a00de65..548e0ca7beeee7e2ec837968b126d33a0d01f99a 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_rendering_workflow/states/confirmed.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_rendering_workflow/states/confirmed.xml @@ -42,8 +42,6 @@ <tuple> <string>deliver</string> <string>deliver_action</string> - <string>reject</string> - <string>reject_action</string> </tuple> </value> </item> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/transitions/cancel.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/transitions/cancel.xml index 4846ec69db0ce70aee1fcebc794431237cc6bf25..c556c28ce4bc102d047d5f3391ba9ed81273cb53 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/transitions/cancel.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/transitions/cancel.xml @@ -89,7 +89,7 @@ <key> <string>roles</string> </key> <value> <tuple> - <string>Assignee</string> + <string>Assignor</string> <string>Manager</string> </tuple> </value> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/transitions/cancel_action.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/transitions/cancel_action.xml index 5460389592234da280bf0346e8517212c8e699ed..700818f326ae1db912847ed9a79cf95f7d68be43 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/transitions/cancel_action.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/transitions/cancel_action.xml @@ -89,7 +89,7 @@ <key> <string>roles</string> </key> <value> <tuple> - <string>Assignee</string> + <string>Assignor</string> <string>Manager</string> </tuple> </value> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml index 49cb928bcb32a9e407116a752ce558c6e37dacf2..ff54cf9dfe00985c1ac8de503c36fb3bbdd2068b 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/vault_transfer_workflow/scripts/validateVaultBalance.xml @@ -74,9 +74,16 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ERP5Type.Message import Message\n \n transaction = state_change.object\n -\n +date = transaction.getStartDate()\n vault = transaction.getSource()\n vaultDestination = transaction.getDestination()\n +\n +# check we are in an opened accounting day\n +if not transaction.Baobab_checkCounterDateOpen(site=vaultDestination, date=date):\n + msg = Message(domain = "ui", message="Counter Date is not opened")\n + raise ValidationFailed, (msg,)\n +\n +\n if \'reserve\' in vault and \'salle_tri\' in vaultDestination:\n msg = Message(domain="ui", message="Cannot transfer ressource to ${destination} from ${source}.",\n mapping={\'source\':transaction.getSourceValue().getParentValue().getTitle(),\n @@ -149,6 +156,7 @@ elif resource <> 0 :\n <string>Message</string> <string>_getattr_</string> <string>transaction</string> + <string>date</string> <string>vault</string> <string>vaultDestination</string> <string>msg</string>