diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_view.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_view.xml index be8f7076e1ba0ad525a6506ed4134b1552318afa..5005303e12143a61d2328eb040872e9f310aab6d 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_view.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_view.xml @@ -108,6 +108,7 @@ <string>my_source_decision_title</string> <string>my_responsible_title</string> <string>my_source_total_asset_price</string> + <string>my_resource_title</string> </list> </value> </item> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_view/my_resource_title.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_view/my_resource_title.xml new file mode 100644 index 0000000000000000000000000000000000000000..d0d51520b96ff5b21264d2528004e36e79d2773c --- /dev/null +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_view/my_resource_title.xml @@ -0,0 +1,272 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.Formulator.StandardFields</string> + <string>StringField</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_resource_title</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> <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>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>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>Currency</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> +</ZopeData> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_viewIncomingLineFastInputDialog.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_viewIncomingLineFastInputDialog.xml index 572ff7db2c490c4879a5f594df8522e8ee440676..20f5b4742e323d108781d0250093083abf1490b4 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_viewIncomingLineFastInputDialog.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_viewIncomingLineFastInputDialog.xml @@ -69,12 +69,22 @@ <item> <key> <string>_body</string> </key> <value> <string>request = context.REQUEST\n +currency = context.getResourceId()\n +\n +if currency != context.Baobab_getPortalReferenceCurrencyID():\n + cash_status = [\'not_defined\']\n + emission_letter = [\'not_defined\']\n + variation = [\'not_defined\']\n +else:\n + cash_status = None\n + emission_letter = None\n + variation = context.Baobab_getResourceVintageList(banknote=1, coin=1)\n \n cash_detail_dict = {\'line_portal_type\' : \'Incoming Cash Incident Line\'\n - , \'operation_currency\' : context.Baobab_getPortalReferenceCurrencyID()\n - , \'cash_status_list\' : None\n - , \'emission_letter_list\' : None\n - , \'variation_list\' : context.Baobab_getResourceVintageList(banknote=1, coin=1)\n + , \'operation_currency\' : currency\n + , \'cash_status_list\' : cash_status\n + , \'emission_letter_list\' : emission_letter\n + , \'variation_list\' : variation\n , \'currency_cash_portal_type\': None\n , \'read_only\' : False\n , \'column_base_category\' : \'variation\'\n @@ -135,6 +145,10 @@ return context.CashDelivery_generateCashDetailInputDialog(listbox = None\n <string>_getattr_</string> <string>context</string> <string>request</string> + <string>currency</string> + <string>cash_status</string> + <string>emission_letter</string> + <string>variation</string> <string>None</string> <string>False</string> <string>cash_detail_dict</string> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_viewOutgoingLineFastInputDialog.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_viewOutgoingLineFastInputDialog.xml index 5772779798f3ad9ef1dbefaf7b8ea029599a9486..92a5ef55ee37500c46d4a4dc353355643351e2cf 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_viewOutgoingLineFastInputDialog.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashIncident_viewOutgoingLineFastInputDialog.xml @@ -69,12 +69,22 @@ <item> <key> <string>_body</string> </key> <value> <string>request = context.REQUEST\n +currency = context.getResourceId()\n +\n +if currency != context.Baobab_getPortalReferenceCurrencyID():\n + cash_status = [\'not_defined\']\n + emission_letter = [\'not_defined\']\n + variation = [\'not_defined\']\n +else:\n + cash_status = None\n + emission_letter = None\n + variation = context.Baobab_getResourceVintageList(banknote=1, coin=1)\n \n cash_detail_dict = {\'line_portal_type\' : \'Outgoing Cash Incident Line\'\n - , \'operation_currency\' : context.Baobab_getPortalReferenceCurrencyID()\n - , \'cash_status_list\' : None\n - , \'emission_letter_list\' : None\n - , \'variation_list\' : context.Baobab_getResourceVintageList(banknote=1, coin=1)\n + , \'operation_currency\' : currency\n + , \'cash_status_list\' : cash_status\n + , \'emission_letter_list\' : emission_letter\n + , \'variation_list\' : variation\n , \'currency_cash_portal_type\': None\n , \'read_only\' : False\n , \'column_base_category\' : \'variation\'\n @@ -135,6 +145,10 @@ return context.CashDelivery_generateCashDetailInputDialog(listbox = None\n <string>_getattr_</string> <string>context</string> <string>request</string> + <string>currency</string> + <string>cash_status</string> + <string>emission_letter</string> + <string>variation</string> <string>None</string> <string>False</string> <string>cash_detail_dict</string> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencySale_getBaobabSource.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencySale_getBaobabSource.xml index 977c5cf82c75d79ee299ea3b316cee6012d5c308..1e6bff2e95a51c345da81570d12c37aee313b75d 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencySale_getBaobabSource.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencySale_getBaobabSource.xml @@ -86,27 +86,28 @@ source = context.getSource()\n baobab_source = None\n \n # Get the history of the workflow\n -user_id=\'None\'\n +user_id=None\n \n for workflow_item in context.Base_getWorkflowHistoryItemList(\'currency_sale_workflow\',display=0):\n \n if workflow_item.getProperty(\'action\')==\'deliver_action\':\n user_id=workflow_item.getProperty(\'actor\')\n \n -site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n +if user_id is not None:\n + site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n \n -for site in site_list:\n - site_value = context.portal_categories.getCategoryValue(site)\n - \n - if site_value.getVaultType().endswith(\'guichet\') and source in site:\n - baobab_source = site + encaisse_devise\n - found = 1\n + for site in site_list:\n + site_value = context.portal_categories.getCategoryValue(site)\n \n - break\n + if site_value.getVaultType().endswith(\'guichet\') and source in site:\n + baobab_source = site + encaisse_devise\n + found = 1\n + \n + break\n \n - if not found:\n - msg = Message(domain=\'ui\', message=\'Your user is not well assigned\')\n - raise ValidationFailed, (msg,)\n + if not found:\n + msg = Message(domain=\'ui\', message=\'Your user is not well assigned\')\n + raise ValidationFailed, (msg,)\n \n return baobab_source\n </string> </value> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/DestructionSurveyModule_viewDestructionSurveyList/listbox.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/DestructionSurveyModule_viewDestructionSurveyList/listbox.xml index c3db747b2669720da0fa2eff46195dc8c7cf7976..3d6fedfaa0bed054964c8ec6ed3471a59180a962 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/DestructionSurveyModule_viewDestructionSurveyList/listbox.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/DestructionSurveyModule_viewDestructionSurveyList/listbox.xml @@ -335,7 +335,7 @@ </tuple> <tuple> <string>source_reference</string> - <string encoding="base64">UsOpZsOpcmVuY2U=</string> + <string>Reference</string> </tuple> <tuple> <string>delivery.start_date</string> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetarySurveyModule_viewMonetarySurveyList/listbox.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetarySurveyModule_viewMonetarySurveyList/listbox.xml index 9f0dc55d0b14e539799e8b5d4a1b3edf49dcc56d..c9da3bc53e2b03d5520249ab2017abfcdf58ea11 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetarySurveyModule_viewMonetarySurveyList/listbox.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MonetarySurveyModule_viewMonetarySurveyList/listbox.xml @@ -341,7 +341,7 @@ </tuple> <tuple> <string>source_reference</string> - <string encoding="base64">UsOpZsOpcmVuY2U=</string> + <string>Reference</string> </tuple> <tuple> <string>delivery.start_date</string> @@ -453,6 +453,10 @@ <list/> </value> </item> + <item> + <key> <string>page_template</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>portal_types</string> </key> <value> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingCashIncidentLine_getBaobabDestination.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingCashIncidentLine_getBaobabDestination.xml index b5f179c04f089b0b82dfd9ea0f51bcd93de91cf0..522447e35df956807de8869c35509c7de1bceef0 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingCashIncidentLine_getBaobabDestination.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingCashIncidentLine_getBaobabDestination.xml @@ -68,7 +68,8 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>return None\n + <value> <string>#return None\n +return context.getSource()\n </string> </value> </item> <item> @@ -119,7 +120,8 @@ <tuple> <string>args</string> <string>kw</string> - <string>None</string> + <string>_getattr_</string> + <string>context</string> </tuple> </value> </item> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/updateBankingOperation.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingCashIncidentLine_getBaobabSource.xml similarity index 70% rename from bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/updateBankingOperation.xml rename to bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingCashIncidentLine_getBaobabSource.xml index 2c1d4a0c6b679dd603007e1af25ed31f5cd5648f..363e48af9a1ea16de70449baaf19fcb405d87d63 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/updateBankingOperation.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingCashIncidentLine_getBaobabSource.xml @@ -68,24 +68,7 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>transaction = state_change[\'object\']\n -bank_account = transaction.getDestinationPaymentValue()\n -price = transaction.getSourceTotalAssetPrice()\n -line = transaction.get(\'movement\')\n -\n -in_list = transaction.objectValues(portal_type=\'Incoming Account Incident Line\')\n -out_list = transaction.objectValues(portal_type=\'Outgoing Account Incident Line\')\n -\n -if (len(in_list)!= 0): \n - if line is not None and line.getPortalType() == \'Banking Operation Line\':\n - # This is a single currency operation, so it is not necessary to convert the price.\n - line.setSourceCredit(price)\n -\n -elif (len(out_list) != 0) :\n - line = transaction.get(\'movement\')\n - if line is not None and line.getPortalType() == \'Banking Operation Line\':\n - # This is a single currency operation, so it is not necessary to convert the price.\n - line.setSourceDebit(price)\n + <value> <string>return None\n </string> </value> </item> <item> @@ -108,15 +91,7 @@ elif (len(out_list) != 0) :\n </item> <item> <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>_proxy_roles</string> </key> - <value> - <tuple> - <string>Manager</string> - </tuple> - </value> + <value> <string>*args, **kw</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -136,22 +111,14 @@ elif (len(out_list) != 0) :\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>1</int> </value> + <value> <int>0</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> - <string>state_change</string> - <string>_getitem_</string> - <string>transaction</string> - <string>_getattr_</string> - <string>bank_account</string> - <string>price</string> - <string>line</string> - <string>in_list</string> - <string>out_list</string> - <string>len</string> + <string>args</string> + <string>kw</string> <string>None</string> </tuple> </value> @@ -169,7 +136,7 @@ elif (len(out_list) != 0) :\n </item> <item> <key> <string>id</string> </key> - <value> <string>updateBankingOperation</string> </value> + <value> <string>OutgoingCashIncidentLine_getBaobabSource</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistency.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistencyAndValidatePositionAccounting.xml similarity index 70% rename from bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistency.xml rename to bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistencyAndValidatePositionAccounting.xml index 7309ddb2295bf23ae5c02d02fbf428ad087d9a73..bd03f4f5dda70845b4f31356fcbd19d5db588a8c 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistency.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistencyAndValidatePositionAccounting.xml @@ -74,12 +74,13 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ERP5Type.Message import Message\n \n -txn = state_change[\'object\']\n +transaction = state_change[\'object\']\n +date = transaction.getStartDate()\n \n -user_id = txn.portal_membership.getAuthenticatedMember().getUserName()\n +user_id = transaction.portal_membership.getAuthenticatedMember().getUserName()\n site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n # context.log(\'validateVaultBalance site_list\',site_list)\n -source = txn.getSource()\n +source = transaction.getSource()\n baobab_source = None\n for site in site_list:\n site_value = context.portal_categories.getCategoryValue(site)\n @@ -90,17 +91,17 @@ source = baobab_source\n source_object = context.portal_categories.getCategoryValue(source)\n \n # check again that we are in the good accounting date\n -if not txn.Baobab_checkCounterDateOpen(site=source_object, date=txn.getStartDate()):\n +if not transaction.Baobab_checkCounterDateOpen(site=source_object, date=date):\n msg = Message(domain = "ui", message="Transaction not in the good accounting date")\n raise ValidationFailed, (msg,)\n \n \n -in_list = txn.objectValues(portal_type=\'Incoming Account Incident Line\')\n -out_list = txn.objectValues(portal_type=\'Outgoing Account Incident Line\')\n -vault = "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(txn.getSource(),)\n -price = txn.getSourceTotalAssetPrice()\n -in_price = txn.getTotalPrice(portal_type=[\'Incoming Account Incident Line\',\'Cash Delivery Cell\'],fast=0)\n -out_price = txn.getTotalPrice(portal_type=[\'Outgoing Account Incident Line\',\'Cash Delivery Cell\'],fast=0)\n +in_list = transaction.objectValues(portal_type=\'Incoming Account Incident Line\')\n +out_list = transaction.objectValues(portal_type=\'Outgoing Account Incident Line\')\n +vault = "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(transaction.getSource(),)\n +price = transaction.getSourceTotalAssetPrice()\n +in_price = transaction.getTotalPrice(portal_type=[\'Incoming Account Incident Line\',\'Cash Delivery Cell\'],fast=0)\n +out_price = transaction.getTotalPrice(portal_type=[\'Outgoing Account Incident Line\',\'Cash Delivery Cell\'],fast=0)\n \n if len(in_list) != 0 and len(out_list) != 0:\n msg = Message(domain = "ui", message="You can\'t have excess and deficit on the document.")\n @@ -110,13 +111,56 @@ elif len(in_list) == 0 and len(out_list) == 0:\n raise ValidationFailed, (msg,)\n elif len(out_list) !=0:\n #resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Outgoing Account Incident Line\')\n - resource = txn.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Outgoing Account Incident Line\')\n + resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Outgoing Account Incident Line\')\n if resource <> 0 :\n msg = Message(domain="ui", message="Insufficient Balance.")\n raise ValidationFailed, (msg,)\n elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != price):\n msg = Message(domain = "ui", message="Price differs between document and resource.")\n raise ValidationFailed, (msg,)\n +\n +# Now we will validate the accounting position\n +transaction = state_change[\'object\']\n +bank_account = transaction.getDestinationPaymentValue()\n +price = transaction.getSourceTotalAssetPrice()\n +line = transaction.get(\'movement\')\n +\n +in_list = transaction.objectValues(portal_type=\'Incoming Account Incident Line\')\n +out_list = transaction.objectValues(portal_type=\'Outgoing Account Incident Line\')\n +\n +debit=0\n +if (len(in_list)!= 0): \n + # This is a single currency operation, so it is not necessary to convert the price.\n + line.setSourceCredit(price)\n +\n +elif (len(out_list) != 0) :\n + # This is a single currency operation, so it is not necessary to convert the price.\n + debit=1\n + line.setSourceDebit(price)\n +\n +# this prevents multiple transactions from being committed at the same time for this bank account.\n +bank_account.serialize()\n +\n +# Make sure there are no other operations pending for this account\n +if transaction.BankAccount_isMessagePending(bank_account):\n + msg = Message(domain=\'ui\', message="There are operations pending for this account that prevent form calculating its position. Please try again later.")\n + raise ValidationFailed, (msg,)\n +\n +# Index the banking operation line so it impacts account position\n +transaction.BankingOperationLine_index(line)\n +\n +if debit:\n + # Test if the account balance is sufficient.\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> @@ -167,8 +211,9 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p <string>Products.ERP5Type.Message</string> <string>Message</string> <string>_getitem_</string> - <string>txn</string> + <string>transaction</string> <string>_getattr_</string> + <string>date</string> <string>user_id</string> <string>context</string> <string>site_list</string> @@ -188,6 +233,10 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p <string>out_price</string> <string>len</string> <string>resource</string> + <string>bank_account</string> + <string>line</string> + <string>debit</string> + <string>error</string> </tuple> </value> </item> @@ -204,7 +253,7 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p </item> <item> <key> <string>id</string> </key> - <value> <string>checkConsistency</string> </value> + <value> <string>checkConsistencyAndValidatePositionAccounting</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/transitions/confirm.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/transitions/confirm.xml index 0d20ec3e12c8f384f4e98cb83f0c17ad3db8b733..2292a26817ed07f3298ea6be1eb960b6960d7815 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/transitions/confirm.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/transitions/confirm.xml @@ -38,7 +38,7 @@ </item> <item> <key> <string>after_script_name</string> </key> - <value> <string>updateBankingOperation</string> </value> + <value> <string></string> </value> </item> <item> <key> <string>description</string> </key> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/transitions/confirm_action.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/transitions/confirm_action.xml index dd6132566d93ad2888e072bae4c6f75258e31a48..2e99999fd3d69c76e1fae1207b9f293899d6f8f7 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/transitions/confirm_action.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/transitions/confirm_action.xml @@ -60,7 +60,7 @@ </item> <item> <key> <string>script_name</string> </key> - <value> <string>checkConsistency</string> </value> + <value> <string>checkConsistencyAndValidatePositionAccounting</string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_incident_workflow/transitions/deliver.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_incident_workflow/transitions/deliver.xml index fc20fe3c595a38144e67292d6e2b21d0f3254ac6..3c9b7f40d104f868568f38c41778478c3e01251b 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_incident_workflow/transitions/deliver.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_incident_workflow/transitions/deliver.xml @@ -32,7 +32,7 @@ </item> <item> <key> <string>after_script_name</string> </key> - <value> <string></string> </value> + <value> <string>updateBankingOperation</string> </value> </item> <item> <key> <string>description</string> </key> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/scripts/validateVaultBalance.xml index ca3d2fcc12515cbc0279dc57273ad9fd42df6fe4..bd2f53cb9985eda23c9d4e9bd35d9a4dd173bf4a 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/scripts/validateVaultBalance.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/usual_cash_transfer_workflow/scripts/validateVaultBalance.xml @@ -88,6 +88,11 @@ if not context.Baobab_checkCounterOpened(site):\n msg = Message(domain = "ui", message="Counter is not opened")\n raise ValidationFailed, (msg,)\n \n +# use of the constraint : Test source and destination\n +vliste = transaction.checkConsistency()\n +transaction.log(\'vliste\', vliste)\n +if len(vliste) != 0:\n + raise ValidationFailed, (vliste[0].getMessage(),)\n \n resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Cash Delivery Line\')\n \n @@ -166,6 +171,9 @@ elif resource <> 0 :\n <string>msg</string> <string>site</string> <string>context</string> + <string>vliste</string> + <string>len</string> + <string>_getitem_</string> <string>resource</string> <string>amount</string> <string>total_price</string> diff --git a/bt5/erp5_banking_cash/bt/revision b/bt5/erp5_banking_cash/bt/revision index 70e1a64c23f0dc1eb79598f64221bd0c38f18b97..bc768da71aa51e6697be661827eee8604e06de95 100644 --- a/bt5/erp5_banking_cash/bt/revision +++ b/bt5/erp5_banking_cash/bt/revision @@ -1 +1 @@ -144 \ No newline at end of file +146 \ No newline at end of file