diff --git a/bt5/erp5_banking_cash/PortalTypeBaseCategoryTemplateItem/base_category_list.xml b/bt5/erp5_banking_cash/PortalTypeBaseCategoryTemplateItem/base_category_list.xml index 0254ef0ae22a0904abea4ef6cef0d42af0d72741..e4bc448969f707d5f67317b51861f5697ea513e5 100644 --- a/bt5/erp5_banking_cash/PortalTypeBaseCategoryTemplateItem/base_category_list.xml +++ b/bt5/erp5_banking_cash/PortalTypeBaseCategoryTemplateItem/base_category_list.xml @@ -28,14 +28,16 @@ <item>emission_letter</item> </portal_type> <portal_type id="Container Line"> - <item>emission_letter</item> <item>variation</item> + <item>emission_letter</item> <item>cash_status</item> </portal_type> <portal_type id="Currency Purchase"> + <item>source_trade</item> <item>currency_exchange_type</item> </portal_type> <portal_type id="Currency Sale"> + <item>source_trade</item> <item>currency_exchange_type</item> </portal_type> <portal_type id="Foreign Cash Reception"> @@ -48,6 +50,7 @@ <item>variation</item> </portal_type> <portal_type id="Money Deposit"> + <item>source_trade</item> <item>external_software</item> </portal_type> <portal_type id="Mutilated Banknote"> diff --git a/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Currency%20Purchase.xml b/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Currency%20Purchase.xml index 4d7ebb3f2ba85b1116f7d93486d9c6fa30c24d18..95c6325687249e9156132f3779385d32afc0a432 100644 --- a/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Currency%20Purchase.xml +++ b/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Currency%20Purchase.xml @@ -109,6 +109,10 @@ <key> <string>init_script</string> </key> <value> <string>CurrencyPurchase_init</string> </value> </item> + <item> + <key> <string>permission</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>property_sheet_list</string> </key> <value> diff --git a/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Currency%20Sale.xml b/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Currency%20Sale.xml index e9426ca1075781d6eae015406c7d1b2c2bdb090e..9a32ac0b3e862e5e45418feb9acbe105e3ce3b6f 100644 --- a/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Currency%20Sale.xml +++ b/bt5/erp5_banking_cash/PortalTypeTemplateItem/portal_types/Currency%20Sale.xml @@ -99,6 +99,10 @@ <key> <string>init_script</string> </key> <value> <string>CurrencySale_init</string> </value> </item> + <item> + <key> <string>permission</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>property_sheet_list</string> </key> <value> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencyPurchase_getBaobabDestination.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencyPurchase_getBaobabDestination.xml index ae7f23410526c43cb8f2401fd74cac603980c658..4e8d74353e3855d49ee11e79ba2c9da6ffff57d5 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencyPurchase_getBaobabDestination.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CurrencyPurchase_getBaobabDestination.xml @@ -65,29 +65,26 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n -from Products.ERP5Type.Message import Message\n -\n -var_ressource_title = context.getResourceTitle().lower()\n -var_ressource_title = var_ressource_title.replace(" ", "_")\n -encaisse_devise = "/encaisse_des_devises/%s/sortante" %(var_ressource_title)\n -\n -#encaisse_devise = "/encaisse_des_devises/%s/sortante" %(context.getResourceTitle().lower())\n -\n -# first get the source of the document,\n -# we will need to add the counter\n -# Get the history of the workflow\n -user_id = context.Base_getLastUserIdByTransition(workflow_id=\'currency_purchase_workflow\', transition_id=\'deliver_action\')\n -if user_id is None:\n - return None\n -site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n -destination = context.getSource()\n -for site in site_list:\n - site_value = context.portal_categories.getCategoryValue(site)\n - if site_value.getVaultType().endswith(\'guichet\') and destination in site:\n - return site + encaisse_devise\n -msg = Message(domain=\'ui\', message=\'Your user is not well assigned\')\n -raise ValidationFailed, (msg,)\n + <value> <string>source_trade = context.getSourceTrade()\n +if source_trade is None:\n + encaisse_devise = "/encaisse_des_devises/%s/sortante" %(context.getResourceTitle(\'\').lower().replace(" ", "_"),)\n + user_id = context.Base_getLastUserIdByTransition(workflow_id=\'currency_purchase_workflow\', transition_id=\'deliver_action\')\n + if user_id is None:\n + return None\n + site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n + destination = context.getSource()\n + for site in site_list:\n + site_value = context.portal_categories.getCategoryValue(site)\n + if site_value.getVaultType().endswith(\'guichet\') and destination in site:\n + source_trade = site + encaisse_devise\n + if context.getSimulationState() == "delivered":\n + context.setSourceTrade(source_trade)\n + return source_trade\n + \n + from Products.DCWorkflow.DCWorkflow import ValidationFailed\n + from Products.ERP5Type.Message import Message\n + msg = Message(domain=\'ui\', message=\'Your user is not well assigned\')\n + raise ValidationFailed, (msg,)\n </string> </value> </item> <item> @@ -138,21 +135,21 @@ raise ValidationFailed, (msg,)\n <tuple> <string>args</string> <string>kw</string> - <string>Products.DCWorkflow.DCWorkflow</string> - <string>ValidationFailed</string> - <string>Products.ERP5Type.Message</string> - <string>Message</string> <string>_getattr_</string> <string>context</string> - <string>var_ressource_title</string> + <string>source_trade</string> + <string>None</string> <string>encaisse_devise</string> <string>user_id</string> - <string>None</string> <string>site_list</string> <string>destination</string> <string>_getiter_</string> <string>site</string> <string>site_value</string> + <string>Products.DCWorkflow.DCWorkflow</string> + <string>ValidationFailed</string> + <string>Products.ERP5Type.Message</string> + <string>Message</string> <string>msg</string> </tuple> </value> 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 0c698a9281993dfd5cd6a4eb1b7b0883091eb1b4..ac5b93d44bb91ab5f78d95f01abc212099408f22 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 @@ -65,32 +65,30 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n -from Products.ERP5Type.Message import Message\n + <value> <string>source_trade = context.getSourceTrade()\n +if source_trade is None:\n + if (context.getResourceTitle() != None):\n + encaisse_devise = "/encaisse_des_devises/%s/sortante" %(context.getResourceTitle().lower().replace(" ", "_"))\n + else:\n + encaisse_devise = "/encaisse_des_devises/"\n \n -if (context.getResourceTitle() != None):\n - var_ressource_title = context.getResourceTitle().lower()\n - var_ressource_title = var_ressource_title.replace(" ", "_")\n - encaisse_devise = "/encaisse_des_devises/%s/sortante" %(var_ressource_title)\n -else:\n - encaisse_devise = "/encaisse_des_devises/"\n -\n -#encaisse_devise = "/encaisse_des_devises/%s/sortante" %(context.getResourceTitle().lower())\n -\n -# first get the source of the document,\n -# we will need to add the counter\n -# Get the history of the workflow\n -user_id = context.Base_getLastUserIdByTransition(workflow_id=\'currency_sale_workflow\', transition_id=\'deliver_action\')\n -if user_id is None:\n - return None\n -site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n -source = context.getSource()\n -for site in site_list:\n - site_value = context.portal_categories.getCategoryValue(site)\n - if site_value.getVaultType().endswith(\'guichet\') and source in site:\n - return site + encaisse_devise\n -msg = Message(domain=\'ui\', message=\'Your user is not well assigned\')\n -raise ValidationFailed, (msg,)\n + user_id = context.Base_getLastUserIdByTransition(workflow_id=\'currency_sale_workflow\', transition_id=\'deliver_action\')\n + if user_id is None:\n + return None\n + site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n + source = context.getSource()\n + for site in site_list:\n + site_value = context.portal_categories.getCategoryValue(site)\n + if site_value.getVaultType().endswith(\'guichet\') and source in site:\n + source_trade = site + encaisse_devise\n + if context.getSimulationState() == "delivered":\n + context.setSourceTrade(source_trade)\n + return source_trade\n + \n + from Products.DCWorkflow.DCWorkflow import ValidationFailed\n + from Products.ERP5Type.Message import Message\n + msg = Message(domain=\'ui\', message=\'Your user is not well assigned\')\n + raise ValidationFailed, (msg,)\n </string> </value> </item> <item> @@ -139,14 +137,10 @@ raise ValidationFailed, (msg,)\n <key> <string>co_varnames</string> </key> <value> <tuple> - <string>Products.DCWorkflow.DCWorkflow</string> - <string>ValidationFailed</string> - <string>Products.ERP5Type.Message</string> - <string>Message</string> <string>_getattr_</string> <string>context</string> + <string>source_trade</string> <string>None</string> - <string>var_ressource_title</string> <string>encaisse_devise</string> <string>user_id</string> <string>site_list</string> @@ -154,6 +148,10 @@ raise ValidationFailed, (msg,)\n <string>_getiter_</string> <string>site</string> <string>site_value</string> + <string>Products.DCWorkflow.DCWorkflow</string> + <string>ValidationFailed</string> + <string>Products.ERP5Type.Message</string> + <string>Message</string> <string>msg</string> </tuple> </value> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/IncomingCashToCurrencyPurchaseLine_getBaobabDestination.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/IncomingCashToCurrencyPurchaseLine_getBaobabDestination.xml index f517fc090386546173954ce0cf64510cfb07b2cd..b308a1e0d34b65285bcc96be1d59024cd3dbbf3c 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/IncomingCashToCurrencyPurchaseLine_getBaobabDestination.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/IncomingCashToCurrencyPurchaseLine_getBaobabDestination.xml @@ -66,16 +66,7 @@ <item> <key> <string>_body</string> </key> <value> <string>currency = context.getResourceTitle()\n -#context.log(\'currency\', currency)\n -var_ressource_title = context.getParentValue().getResourceTitle().lower()\n -var_ressource_title = var_ressource_title.replace(" ", "_")\n -#context.log(\'var_ressource_title\', var_ressource_title)\n -\n -#encaisse_devise = "/encaisse_des_devises/%s/entrante" %(context.getParentValue().getResourceTitle().lower())\n -encaisse_devise = "/encaisse_des_devises/%s/sortante" %(var_ressource_title)\n -\n -#context.log(\'encaisse_devise\', encaisse_devise)\n -\n +encaisse_devise = "/encaisse_des_devises/%s/sortante" %(context.getParentValue().getResourceTitle(\'\').lower().replace(" ", "_"))\n counter_site = context.getSource()\n destination = counter_site + encaisse_devise\n return destination\n @@ -155,7 +146,6 @@ return destination\n <string>_getattr_</string> <string>context</string> <string>currency</string> - <string>var_ressource_title</string> <string>encaisse_devise</string> <string>counter_site</string> <string>destination</string> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabDestination.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabDestination.xml index 4c4e837c71215e5c0a4e9990fe171c563a9b1f51..4699e59b2e365fc4b83a100751f45133579a17ba 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabDestination.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/MoneyDeposit_getBaobabDestination.xml @@ -65,20 +65,26 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>destination = context.getDestination()\n -if destination is None:\n - return None\n -user_id = context.Base_getLastUserIdByTransition(workflow_id=\'money_deposit_workflow\', transition_id=\'deliver_action\')\n -context.log(\'user_id\',user_id)\n -if user_id is None:\n - return None\n -site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n -for site in site_list:\n - if context.portal_categories.getCategoryValue(site).getVaultType().endswith(\'guichet\') and destination in site:\n - return site + \'/encaisse_des_billets_et_monnaies/entrante\'\n -from Products.ERP5Type.Message import Message\n -message = Message(domain="ui", message="The owner is not assigned to the right vault.")\n -raise ValueError,message\n + <value> <string>source_trade = context.getSourceTrade()\n +if source_trade is None:\n + destination = context.getDestination()\n + if destination is None:\n + return None\n + user_id = context.Base_getLastUserIdByTransition(workflow_id=\'money_deposit_workflow\', transition_id=\'deliver_action\')\n + if user_id is None:\n + return None\n + site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n + for site in site_list:\n + if context.portal_categories.getCategoryValue(site).getVaultType().endswith(\'guichet\') and destination in site:\n + source_trade = site + \'/encaisse_des_billets_et_monnaies/entrante\'\n + if context.getSimulationState() == \'delivered\':\n + context.setSourceTrade(source_trade)\n + return source_trade\n + from Products.ERP5Type.Message import Message\n + message = Message(domain="ui", message="The owner is not assigned to the right vault.")\n + raise ValueError,message\n +else:\n + return source_trade\n </string> </value> </item> <item> @@ -131,8 +137,9 @@ raise ValueError,message\n <string>kw</string> <string>_getattr_</string> <string>context</string> - <string>destination</string> + <string>source_trade</string> <string>None</string> + <string>destination</string> <string>user_id</string> <string>site_list</string> <string>_getiter_</string> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/VaultTransferCell_getBaobabDestinationVariationText.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/VaultTransferCell_getBaobabDestinationVariationText.xml index 9ac6dd1d2f9e9435621874f1bb6823ff984f7ac2..cf637c316c2084d4aafffbee9108de4f40882a45 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/VaultTransferCell_getBaobabDestinationVariationText.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/VaultTransferCell_getBaobabDestinationVariationText.xml @@ -73,6 +73,7 @@ if source.split("/")[-1] == destination.split("/")[-1]:\n variation = context.getVariationText()\n result = variation.replace(\'new_emitted\', \'valid\')\n return result\n +return context.getVariationText()\n </string> </value> </item> <item> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistencyAndValidatePositionAccounting.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistencyAndValidatePositionAccounting.xml index 393c22105002af688ce39cd6c4f53f7ffe398ee5..54bd6e1d60f48d48eadeb0692ad73ad201009fc2 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistencyAndValidatePositionAccounting.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/account_incident_workflow/scripts/checkConsistencyAndValidatePositionAccounting.xml @@ -96,28 +96,27 @@ if not transaction.Baobab_checkCounterDateOpen(site=source_object, date=date):\n raise ValidationFailed, (msg,)\n \n \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 +if in_price == 0 and out_price == 0: # Both prices cannot be equal to 0 at the same time\n + msg = Message(domain = "ui", message="No resource.")\n + raise ValidationFailed, (msg,)\n +elif 0 not in (in_price, out_price): # Both prices cannot be different from 0 at the same time\n msg = Message(domain = "ui", message="You can\'t have excess and deficit on the document.")\n raise ValidationFailed, (msg,)\n -elif len(in_list) == 0 and len(out_list) == 0:\n - msg = Message(domain = "ui", message="No resource.")\n +elif price not in (in_price, out_price):\n + msg = Message(domain = "ui", message="Price differs between document and resource.")\n raise ValidationFailed, (msg,)\n -elif len(out_list) !=0:\n +\n +if out_price != 0:\n #resource = transaction.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 @@ -229,18 +228,18 @@ if debit:\n <string>site_value</string> <string>source_object</string> <string>msg</string> - <string>in_list</string> - <string>out_list</string> <string>vault</string> <string>price</string> <string>in_price</string> <string>out_price</string> - <string>len</string> <string>resource</string> <string>bank_account</string> <string>exchange_rate_list</string> + <string>len</string> <string>ValidationError</string> <string>line</string> + <string>in_list</string> + <string>out_list</string> <string>debit</string> <string>error</string> </tuple> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_exchange_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_exchange_workflow/scripts/validateVaultBalance.xml index 9c7d3d57f206d495a87cf90e6802fbf131c02ed1..7302e847a1dcb5ea031328f2bc4a2427dea536b5 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_exchange_workflow/scripts/validateVaultBalance.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_exchange_workflow/scripts/validateVaultBalance.xml @@ -67,7 +67,7 @@ <key> <string>_body</string> </key> <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ERP5Type.Message import Message\n -transaction = state_change.object\n +transaction = state_change[\'object\']\n \n currency = transaction.getResourceTitle()\n encaisse_billets_et_monnaies_sortante = "/encaisse_des_billets_et_monnaies/sortante"\n @@ -78,6 +78,8 @@ counter_site = transaction.getSource()\n caisse_incoming = counter_site + encaisse_billets_et_monnaies_entrante\n caisse_outgoing = counter_site + encaisse_billets_et_monnaies_sortante\n \n +# check we don\'t change of user\n +transaction.Baobab_checkSameUserVault(counter_site)\n \n # check again that we are in the good accounting date\n if not transaction.Baobab_checkCounterDateOpen(site=caisse_outgoing, date=transaction.getStartDate()):\n @@ -85,10 +87,10 @@ if not transaction.Baobab_checkCounterDateOpen(site=caisse_outgoing, date=transa raise ValidationFailed, (msg,)\n \n # use of the constraint : Test cash status line\n -vliste = transaction.checkConsistency()\n -transaction.log(\'vliste\', vliste)\n -if len(vliste) != 0:\n - raise ValidationFailed, (vliste[0].getMessage(),)\n +#vliste = transaction.checkConsistency()\n +#transaction.log(\'vliste\', vliste)\n +#if len(vliste) != 0:\n +# raise ValidationFailed, (vliste[0].getMessage(),)\n \n \n resource_two = transaction.CashDelivery_checkCounterInventory(caisse_outgoing, portal_type=\'Outgoing Cash Exchange Line\')\n @@ -169,8 +171,9 @@ if amount_total != outgoing_total:\n <string>ValidationFailed</string> <string>Products.ERP5Type.Message</string> <string>Message</string> - <string>_getattr_</string> + <string>_getitem_</string> <string>transaction</string> + <string>_getattr_</string> <string>currency</string> <string>encaisse_billets_et_monnaies_sortante</string> <string>encaisse_billets_et_monnaies_entrante</string> @@ -178,9 +181,6 @@ if amount_total != outgoing_total:\n <string>caisse_incoming</string> <string>caisse_outgoing</string> <string>msg</string> - <string>vliste</string> - <string>len</string> - <string>_getitem_</string> <string>resource_two</string> <string>incoming_total</string> <string>outgoing_total</string> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_purchase_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_purchase_workflow/scripts/validateVaultBalance.xml index b6542d025daa8271e345adffdd26839a7ec57749..9e2ea570f8ec8801f5fa08ac87af3a212d23f697 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_purchase_workflow/scripts/validateVaultBalance.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/cash_to_currency_purchase_workflow/scripts/validateVaultBalance.xml @@ -69,7 +69,7 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ERP5Type.Message import Message\n -transaction = state_change.object\n +transaction = state_change[\'object\']\n \n currency = transaction.getResourceTitle()\n encaisse_billets_et_monnaies = "/encaisse_des_billets_et_monnaies/sortante"\n @@ -82,6 +82,10 @@ encaisse_devise = "/encaisse_des_devises/%s/entrante" %(var_ressource_title)\n #encaisse_devise = "/encaisse_des_devises/%s/entrante" %(transaction.getResourceTitle().lower())\n \n counter_site = transaction.getSource()\n +\n +# check we don\'t change of user\n +transaction.Baobab_checkSameUserVault(counter_site)\n +\n incoming_destination = counter_site + encaisse_devise\n outgoing_source = counter_site + encaisse_billets_et_monnaies\n \n @@ -180,8 +184,9 @@ elif resource_two!= 0 :\n <string>ValidationFailed</string> <string>Products.ERP5Type.Message</string> <string>Message</string> - <string>_getattr_</string> + <string>_getitem_</string> <string>transaction</string> + <string>_getattr_</string> <string>currency</string> <string>encaisse_billets_et_monnaies</string> <string>var_ressource_title</string> 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 3cc026be3e2ea3845ce59c30d95fab165b05cdcc..c5c23706023c067d2fb0956fad7aee2ca9079b1a 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 @@ -67,7 +67,7 @@ <key> <string>_body</string> </key> <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.ERP5Type.Message import Message\n -transaction = state_change.object\n +transaction = state_change[\'object\']\n \n currency = transaction.getResourceTitle()\n \n @@ -82,6 +82,8 @@ encaisse_billets_et_monnaies = "/encaisse_des_billets_et_monnaies/entrante"\n \n counter_site = transaction.getSource()\n \n +# check we don\'t change of user\n +transaction.Baobab_checkSameUserVault(counter_site)\n \n outgoing_source = counter_site + encaisse_devise\n \n @@ -91,10 +93,10 @@ if not transaction.Baobab_checkCounterDateOpen(site=outgoing_source, date=transa raise ValidationFailed, (msg,)\n \n # use of the constraint : Test cash status line\n -vliste = transaction.checkConsistency()\n -transaction.log(\'vliste\', vliste)\n -if len(vliste) != 0:\n - raise ValidationFailed, (vliste[0].getMessage(),)\n +#vliste = transaction.checkConsistency()\n +#transaction.log(\'vliste\', vliste)\n +#if len(vliste) != 0:\n +# raise ValidationFailed, (vliste[0].getMessage(),)\n \n \n \n @@ -176,8 +178,9 @@ elif resource_one != 0 :\n <string>ValidationFailed</string> <string>Products.ERP5Type.Message</string> <string>Message</string> - <string>_getattr_</string> + <string>_getitem_</string> <string>transaction</string> + <string>_getattr_</string> <string>currency</string> <string>var_ressource_title</string> <string>encaisse_devise</string> @@ -185,9 +188,6 @@ elif resource_one != 0 :\n <string>counter_site</string> <string>outgoing_source</string> <string>msg</string> - <string>vliste</string> - <string>len</string> - <string>_getitem_</string> <string>resource_one</string> <string>billetage_entre</string> <string>billetage_sorti</string> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/counter_rendering_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/counter_rendering_workflow/scripts/validateVaultBalance.xml index 31195020a6a5f42316ceb82ecb63952dc2b4452b..dbb4b4a1a0690412d8faf4e048a42b2e3ab9e546 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/counter_rendering_workflow/scripts/validateVaultBalance.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/counter_rendering_workflow/scripts/validateVaultBalance.xml @@ -75,6 +75,9 @@ transaction = state_change.object\n vault = transaction.getSource()\n date = transaction.getStartDate()\n \n +# check we don\'t change of user\n +transaction.Baobab_checkSameUserVault(vault)\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 diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/internal_money_deposit_workflow/scripts/validateCounter.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/internal_money_deposit_workflow/scripts/validateCounter.xml index c72897a6515a404c637b9fbd44f59e16b4cb5e40..5eaf47780b2ba8bef9f4cc6e3bc1563e5157464f 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/internal_money_deposit_workflow/scripts/validateCounter.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/internal_money_deposit_workflow/scripts/validateCounter.xml @@ -78,7 +78,9 @@ if transaction.getResource() is None:\n #transaction.Base_checkBaobabSourceAndDestination()\n \n date = transaction.getStartDate()\n -destination= transaction.getDestination(None)\n +destination= transaction.getDestination()\n +# check we don\'t change of user\n +transaction.Baobab_checkSameUserVault(destination)\n \n lettering = transaction.getGroupingReference()\n \n diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/money_deposit_workflow/scripts/validateVaultBalance.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/money_deposit_workflow/scripts/validateVaultBalance.xml index 13883cd84eba0b3f61c1f72739b002d6398828cc..72d5c45086e42b54a68dc653030b586fa35f50bc 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/money_deposit_workflow/scripts/validateVaultBalance.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/money_deposit_workflow/scripts/validateVaultBalance.xml @@ -76,10 +76,10 @@ resource = transaction.CashDelivery_checkCounterInventory(source = destination, #transaction.log("call to CashDelivery_getCounterInventory return", resource)\n \n # use of the constraint : Test cash status line\n -vliste = transaction.checkConsistency()\n -transaction.log(\'vliste\', vliste)\n -if len(vliste) != 0:\n - raise ValidationFailed, (vliste[0].getMessage(),)\n +#vliste = transaction.checkConsistency()\n +#transaction.log(\'vliste\', vliste)\n +#if len(vliste) != 0:\n +# raise ValidationFailed, (vliste[0].getMessage(),)\n \n user_id = transaction.portal_membership.getAuthenticatedMember().getUserName()\n site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n @@ -171,8 +171,6 @@ elif price != cash_detail:\n <string>_getattr_</string> <string>destination</string> <string>resource</string> - <string>vliste</string> - <string>len</string> <string>user_id</string> <string>context</string> <string>site_list</string> diff --git a/bt5/erp5_banking_cash/bt/revision b/bt5/erp5_banking_cash/bt/revision index 4f37670799715b48e31ab1be1c419f6ddbb19056..cfd6ea5ae435e24719c0a9a765bf2e1ed776cf17 100644 --- a/bt5/erp5_banking_cash/bt/revision +++ b/bt5/erp5_banking_cash/bt/revision @@ -1 +1 @@ -333 \ No newline at end of file +335 \ No newline at end of file diff --git a/bt5/erp5_banking_cash/bt/template_portal_type_base_category_list b/bt5/erp5_banking_cash/bt/template_portal_type_base_category_list index 2c560bb7969a0f2b67dee96a2a05c23047947503..f31eff0af475cfe2145e9f8876099144cf539a9e 100644 --- a/bt5/erp5_banking_cash/bt/template_portal_type_base_category_list +++ b/bt5/erp5_banking_cash/bt/template_portal_type_base_category_list @@ -14,11 +14,14 @@ Container Line | cash_status Container Line | emission_letter Container Line | variation Currency Purchase | currency_exchange_type +Currency Purchase | source_trade Currency Sale | currency_exchange_type +Currency Sale | source_trade Foreign Cash Reception | currency_exchange_type Internal Money Deposit | external_software Monetary Recall Cell | variation Money Deposit | external_software +Money Deposit | source_trade Mutilated Banknote | source_decision Mutilated Banknote | source_trade Outgoing Cash Sorting Cell | variation diff --git a/bt5/erp5_banking_check/PortalTypeBaseCategoryTemplateItem/base_category_list.xml b/bt5/erp5_banking_check/PortalTypeBaseCategoryTemplateItem/base_category_list.xml index 58dbe659e084e8c63b91bd06f74ed75c37fa3cbb..0a71212a15fc712db5141f9d203f6087e0e9ac7d 100644 --- a/bt5/erp5_banking_check/PortalTypeBaseCategoryTemplateItem/base_category_list.xml +++ b/bt5/erp5_banking_check/PortalTypeBaseCategoryTemplateItem/base_category_list.xml @@ -3,6 +3,7 @@ <item>site</item> </portal_type> <portal_type id="Check Payment"> + <item>source_trade</item> <item>aggregate_resource</item> </portal_type> <portal_type id="Checkbook Delivery"> @@ -14,12 +15,12 @@ <item>currency_exchange_type</item> </portal_type> <portal_type id="Checkbook Reception Line"> - <item>check_amount</item> <item>check_type</item> + <item>check_amount</item> </portal_type> <portal_type id="Stop Payment"> - <item>aggregate_resource</item> <item>currency_exchange_type</item> + <item>aggregate_resource</item> </portal_type> <portal_type id="Traveler Check Purchase"> <item>currency_exchange_type</item> diff --git a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckPayment_getBaobabSource.xml b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckPayment_getBaobabSource.xml index 51b72cf2c43d65c9a836f17fc12c37b333610559..3c2904529fd5fa3349d5d0f001c82ab1deb17e2d 100644 --- a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckPayment_getBaobabSource.xml +++ b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckPayment_getBaobabSource.xml @@ -65,16 +65,21 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>user_id = context.Base_getLastUserIdByTransition(workflow_id=\'check_payment_workflow\', transition_id=\'deliver_action\')\n -if user_id is None:\n - return None\n -site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n -source = context.getSource()\n -for site in site_list:\n - site_value = context.portal_categories.getCategoryValue(site)\n - if site_value.getVaultType().endswith(\'guichet\') and source in site:\n - return site + \'/encaisse_des_billets_et_monnaies/sortante\'\n -return None\n + <value> <string>source_trade = context.getSourceTrade()\n +if source_trade is None:\n + user_id = context.Base_getLastUserIdByTransition(workflow_id=\'check_payment_workflow\', transition_id=\'deliver_action\')\n + if user_id is not None:\n + site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n + source = context.getSource()\n + for site in site_list:\n + site_value = context.portal_categories.getCategoryValue(site)\n + if site_value.getVaultType().endswith(\'guichet\') and source in site:\n + source_trade = site + \'/encaisse_des_billets_et_monnaies/sortante\'\n + # Save it only once we are sure that the document will not change any more\n + # and that we will not have many users trying to do deliver_action\n + if context.getSimulationState() == \'delivered\':\n + context.setSourceTrade(source_trade)\n +return source_trade\n </string> </value> </item> <item> @@ -126,8 +131,9 @@ return None\n <string>kw</string> <string>_getattr_</string> <string>context</string> - <string>user_id</string> + <string>source_trade</string> <string>None</string> + <string>user_id</string> <string>site_list</string> <string>source</string> <string>_getiter_</string> diff --git a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/traveler_check_purchase_workflow/scripts/validatePositionAccounting.xml b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/traveler_check_purchase_workflow/scripts/validatePositionAccounting.xml index 3493a79de7137a07811a64b2757ea1a0090c7855..0c216dec5e33d99317bc167d2b1577fab519d822 100644 --- a/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/traveler_check_purchase_workflow/scripts/validatePositionAccounting.xml +++ b/bt5/erp5_banking_check/WorkflowTemplateItem/portal_workflow/traveler_check_purchase_workflow/scripts/validatePositionAccounting.xml @@ -78,6 +78,9 @@ if source is None:\n msg = Message(domain=\'ui\', message=\'No counter defined.\')\n raise ValidationFailed, (msg,)\n \n +# check we don\'t change of user\n +transaction.Baobab_checkSameUserVault(source)\n +\n # check we are in an opened accounting day\n if not transaction.Baobab_checkCounterDateOpen(site=source, date=date):\n msg = Message(domain = "ui", message="Counter Date is not opened")\n @@ -199,6 +202,7 @@ if total_credit>0:\n <string>item</string> <string>category_list</string> <string>base_price</string> + <string>_inplacevar_</string> <string>round</string> </tuple> </value> diff --git a/bt5/erp5_banking_check/bt/revision b/bt5/erp5_banking_check/bt/revision index 02225a563f9711d2f3a52d071d1249ed9f2dea93..2a14d60899b5ce63b22aa762057236cb35531a10 100644 --- a/bt5/erp5_banking_check/bt/revision +++ b/bt5/erp5_banking_check/bt/revision @@ -1 +1 @@ -268 \ No newline at end of file +270 \ No newline at end of file diff --git a/bt5/erp5_banking_check/bt/template_portal_type_base_category_list b/bt5/erp5_banking_check/bt/template_portal_type_base_category_list index ce656be7f74fc6c19a88c05047fb520576931b87..d43a8331cc97248c1232e869a44c8270402e2918 100644 --- a/bt5/erp5_banking_check/bt/template_portal_type_base_category_list +++ b/bt5/erp5_banking_check/bt/template_portal_type_base_category_list @@ -1,5 +1,6 @@ Check Deposit | site Check Payment | aggregate_resource +Check Payment | source_trade Checkbook Delivery Line | check_amount Checkbook Delivery Line | check_type Checkbook Delivery Line | currency_exchange_type