Commit a72ec045 authored by Aurel's avatar Aurel

* user which did 'deliver action' is now record on object to prevent...

* user which did 'deliver action' is now record on object to prevent indexation pb if his assignment change in future
* check we pass wf transition with the user assigned at the same vault as the original one

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14675 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cd8201b8
...@@ -28,14 +28,16 @@ ...@@ -28,14 +28,16 @@
<item>emission_letter</item> <item>emission_letter</item>
</portal_type> </portal_type>
<portal_type id="Container Line"> <portal_type id="Container Line">
<item>emission_letter</item>
<item>variation</item> <item>variation</item>
<item>emission_letter</item>
<item>cash_status</item> <item>cash_status</item>
</portal_type> </portal_type>
<portal_type id="Currency Purchase"> <portal_type id="Currency Purchase">
<item>source_trade</item>
<item>currency_exchange_type</item> <item>currency_exchange_type</item>
</portal_type> </portal_type>
<portal_type id="Currency Sale"> <portal_type id="Currency Sale">
<item>source_trade</item>
<item>currency_exchange_type</item> <item>currency_exchange_type</item>
</portal_type> </portal_type>
<portal_type id="Foreign Cash Reception"> <portal_type id="Foreign Cash Reception">
...@@ -48,6 +50,7 @@ ...@@ -48,6 +50,7 @@
<item>variation</item> <item>variation</item>
</portal_type> </portal_type>
<portal_type id="Money Deposit"> <portal_type id="Money Deposit">
<item>source_trade</item>
<item>external_software</item> <item>external_software</item>
</portal_type> </portal_type>
<portal_type id="Mutilated Banknote"> <portal_type id="Mutilated Banknote">
......
...@@ -109,6 +109,10 @@ ...@@ -109,6 +109,10 @@
<key> <string>init_script</string> </key> <key> <string>init_script</string> </key>
<value> <string>CurrencyPurchase_init</string> </value> <value> <string>CurrencyPurchase_init</string> </value>
</item> </item>
<item>
<key> <string>permission</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>property_sheet_list</string> </key> <key> <string>property_sheet_list</string> </key>
<value> <value>
......
...@@ -99,6 +99,10 @@ ...@@ -99,6 +99,10 @@
<key> <string>init_script</string> </key> <key> <string>init_script</string> </key>
<value> <string>CurrencySale_init</string> </value> <value> <string>CurrencySale_init</string> </value>
</item> </item>
<item>
<key> <string>permission</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>property_sheet_list</string> </key> <key> <string>property_sheet_list</string> </key>
<value> <value>
......
...@@ -65,29 +65,26 @@ ...@@ -65,29 +65,26 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n <value> <string>source_trade = context.getSourceTrade()\n
from Products.ERP5Type.Message import Message\n if source_trade is None:\n
\n encaisse_devise = "/encaisse_des_devises/%s/sortante" %(context.getResourceTitle(\'\').lower().replace(" ", "_"),)\n
var_ressource_title = context.getResourceTitle().lower()\n user_id = context.Base_getLastUserIdByTransition(workflow_id=\'currency_purchase_workflow\', transition_id=\'deliver_action\')\n
var_ressource_title = var_ressource_title.replace(" ", "_")\n if user_id is None:\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 return None\n
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n
destination = context.getSource()\n destination = context.getSource()\n
for site in site_list:\n for site in site_list:\n
site_value = context.portal_categories.getCategoryValue(site)\n site_value = context.portal_categories.getCategoryValue(site)\n
if site_value.getVaultType().endswith(\'guichet\') and destination in site:\n if site_value.getVaultType().endswith(\'guichet\') and destination in site:\n
return site + encaisse_devise\n source_trade = site + encaisse_devise\n
msg = Message(domain=\'ui\', message=\'Your user is not well assigned\')\n if context.getSimulationState() == "delivered":\n
raise ValidationFailed, (msg,)\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> </string> </value>
</item> </item>
<item> <item>
...@@ -138,21 +135,21 @@ raise ValidationFailed, (msg,)\n ...@@ -138,21 +135,21 @@ raise ValidationFailed, (msg,)\n
<tuple> <tuple>
<string>args</string> <string>args</string>
<string>kw</string> <string>kw</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>var_ressource_title</string> <string>source_trade</string>
<string>None</string>
<string>encaisse_devise</string> <string>encaisse_devise</string>
<string>user_id</string> <string>user_id</string>
<string>None</string>
<string>site_list</string> <string>site_list</string>
<string>destination</string> <string>destination</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>site</string> <string>site</string>
<string>site_value</string> <string>site_value</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>msg</string> <string>msg</string>
</tuple> </tuple>
</value> </value>
......
...@@ -65,32 +65,30 @@ ...@@ -65,32 +65,30 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n <value> <string>source_trade = context.getSourceTrade()\n
from Products.ERP5Type.Message import Message\n if source_trade is None:\n
\n if (context.getResourceTitle() != None):\n
if (context.getResourceTitle() != None):\n encaisse_devise = "/encaisse_des_devises/%s/sortante" %(context.getResourceTitle().lower().replace(" ", "_"))\n
var_ressource_title = context.getResourceTitle().lower()\n else:\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 encaisse_devise = "/encaisse_des_devises/"\n
\n \n
#encaisse_devise = "/encaisse_des_devises/%s/sortante" %(context.getResourceTitle().lower())\n user_id = context.Base_getLastUserIdByTransition(workflow_id=\'currency_sale_workflow\', transition_id=\'deliver_action\')\n
\n if user_id is None:\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 return None\n
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n
source = context.getSource()\n source = context.getSource()\n
for site in site_list:\n for site in site_list:\n
site_value = context.portal_categories.getCategoryValue(site)\n site_value = context.portal_categories.getCategoryValue(site)\n
if site_value.getVaultType().endswith(\'guichet\') and source in site:\n if site_value.getVaultType().endswith(\'guichet\') and source in site:\n
return site + encaisse_devise\n source_trade = site + encaisse_devise\n
msg = Message(domain=\'ui\', message=\'Your user is not well assigned\')\n if context.getSimulationState() == "delivered":\n
raise ValidationFailed, (msg,)\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> </string> </value>
</item> </item>
<item> <item>
...@@ -139,14 +137,10 @@ raise ValidationFailed, (msg,)\n ...@@ -139,14 +137,10 @@ raise ValidationFailed, (msg,)\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>source_trade</string>
<string>None</string> <string>None</string>
<string>var_ressource_title</string>
<string>encaisse_devise</string> <string>encaisse_devise</string>
<string>user_id</string> <string>user_id</string>
<string>site_list</string> <string>site_list</string>
...@@ -154,6 +148,10 @@ raise ValidationFailed, (msg,)\n ...@@ -154,6 +148,10 @@ raise ValidationFailed, (msg,)\n
<string>_getiter_</string> <string>_getiter_</string>
<string>site</string> <string>site</string>
<string>site_value</string> <string>site_value</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>msg</string> <string>msg</string>
</tuple> </tuple>
</value> </value>
......
...@@ -66,16 +66,7 @@ ...@@ -66,16 +66,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>currency = context.getResourceTitle()\n <value> <string>currency = context.getResourceTitle()\n
#context.log(\'currency\', currency)\n encaisse_devise = "/encaisse_des_devises/%s/sortante" %(context.getParentValue().getResourceTitle(\'\').lower().replace(" ", "_"))\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
counter_site = context.getSource()\n counter_site = context.getSource()\n
destination = counter_site + encaisse_devise\n destination = counter_site + encaisse_devise\n
return destination\n return destination\n
...@@ -155,7 +146,6 @@ return destination\n ...@@ -155,7 +146,6 @@ return destination\n
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>currency</string> <string>currency</string>
<string>var_ressource_title</string>
<string>encaisse_devise</string> <string>encaisse_devise</string>
<string>counter_site</string> <string>counter_site</string>
<string>destination</string> <string>destination</string>
......
...@@ -65,20 +65,26 @@ ...@@ -65,20 +65,26 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>destination = context.getDestination()\n <value> <string>source_trade = context.getSourceTrade()\n
if destination is None:\n if source_trade is None:\n
destination = context.getDestination()\n
if destination is None:\n
return None\n return None\n
user_id = context.Base_getLastUserIdByTransition(workflow_id=\'money_deposit_workflow\', transition_id=\'deliver_action\')\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
if user_id is None:\n
return None\n return None\n
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n
for site in site_list:\n for site in site_list:\n
if context.portal_categories.getCategoryValue(site).getVaultType().endswith(\'guichet\') and destination in site:\n if context.portal_categories.getCategoryValue(site).getVaultType().endswith(\'guichet\') and destination in site:\n
return site + \'/encaisse_des_billets_et_monnaies/entrante\'\n source_trade = site + \'/encaisse_des_billets_et_monnaies/entrante\'\n
from Products.ERP5Type.Message import Message\n if context.getSimulationState() == \'delivered\':\n
message = Message(domain="ui", message="The owner is not assigned to the right vault.")\n context.setSourceTrade(source_trade)\n
raise ValueError,message\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> </string> </value>
</item> </item>
<item> <item>
...@@ -131,8 +137,9 @@ raise ValueError,message\n ...@@ -131,8 +137,9 @@ raise ValueError,message\n
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>destination</string> <string>source_trade</string>
<string>None</string> <string>None</string>
<string>destination</string>
<string>user_id</string> <string>user_id</string>
<string>site_list</string> <string>site_list</string>
<string>_getiter_</string> <string>_getiter_</string>
......
...@@ -73,6 +73,7 @@ if source.split("/")[-1] == destination.split("/")[-1]:\n ...@@ -73,6 +73,7 @@ if source.split("/")[-1] == destination.split("/")[-1]:\n
variation = context.getVariationText()\n variation = context.getVariationText()\n
result = variation.replace(\'new_emitted\', \'valid\')\n result = variation.replace(\'new_emitted\', \'valid\')\n
return result\n return result\n
return context.getVariationText()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -96,28 +96,27 @@ if not transaction.Baobab_checkCounterDateOpen(site=source_object, date=date):\n ...@@ -96,28 +96,27 @@ if not transaction.Baobab_checkCounterDateOpen(site=source_object, date=date):\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \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 vault = "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(transaction.getSource(),)\n
price = transaction.getSourceTotalAssetPrice()\n price = transaction.getSourceTotalAssetPrice()\n
in_price = transaction.getTotalPrice(portal_type=[\'Incoming Account Incident Line\',\'Cash Delivery Cell\'],fast=0)\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 out_price = transaction.getTotalPrice(portal_type=[\'Outgoing Account Incident Line\',\'Cash Delivery Cell\'],fast=0)\n
\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 msg = Message(domain = "ui", message="You can\'t have excess and deficit on the document.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
elif len(in_list) == 0 and len(out_list) == 0:\n elif price not in (in_price, out_price):\n
msg = Message(domain = "ui", message="No resource.")\n msg = Message(domain = "ui", message="Price differs between document and resource.")\n
raise ValidationFailed, (msg,)\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
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 if resource <> 0 :\n
msg = Message(domain="ui", message="Insufficient Balance.")\n msg = Message(domain="ui", message="Insufficient Balance.")\n
raise ValidationFailed, (msg,)\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 \n
# Now we will validate the accounting position\n # Now we will validate the accounting position\n
transaction = state_change[\'object\']\n transaction = state_change[\'object\']\n
...@@ -229,18 +228,18 @@ if debit:\n ...@@ -229,18 +228,18 @@ if debit:\n
<string>site_value</string> <string>site_value</string>
<string>source_object</string> <string>source_object</string>
<string>msg</string> <string>msg</string>
<string>in_list</string>
<string>out_list</string>
<string>vault</string> <string>vault</string>
<string>price</string> <string>price</string>
<string>in_price</string> <string>in_price</string>
<string>out_price</string> <string>out_price</string>
<string>len</string>
<string>resource</string> <string>resource</string>
<string>bank_account</string> <string>bank_account</string>
<string>exchange_rate_list</string> <string>exchange_rate_list</string>
<string>len</string>
<string>ValidationError</string> <string>ValidationError</string>
<string>line</string> <string>line</string>
<string>in_list</string>
<string>out_list</string>
<string>debit</string> <string>debit</string>
<string>error</string> <string>error</string>
</tuple> </tuple>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
transaction = state_change.object\n transaction = state_change[\'object\']\n
\n \n
currency = transaction.getResourceTitle()\n currency = transaction.getResourceTitle()\n
encaisse_billets_et_monnaies_sortante = "/encaisse_des_billets_et_monnaies/sortante"\n encaisse_billets_et_monnaies_sortante = "/encaisse_des_billets_et_monnaies/sortante"\n
...@@ -78,6 +78,8 @@ counter_site = transaction.getSource()\n ...@@ -78,6 +78,8 @@ counter_site = transaction.getSource()\n
caisse_incoming = counter_site + encaisse_billets_et_monnaies_entrante\n caisse_incoming = counter_site + encaisse_billets_et_monnaies_entrante\n
caisse_outgoing = counter_site + encaisse_billets_et_monnaies_sortante\n caisse_outgoing = counter_site + encaisse_billets_et_monnaies_sortante\n
\n \n
# check we don\'t change of user\n
transaction.Baobab_checkSameUserVault(counter_site)\n
\n \n
# check again that we are in the good accounting date\n # check again that we are in the good accounting date\n
if not transaction.Baobab_checkCounterDateOpen(site=caisse_outgoing, date=transaction.getStartDate()):\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 ...@@ -85,10 +87,10 @@ if not transaction.Baobab_checkCounterDateOpen(site=caisse_outgoing, date=transa
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
# use of the constraint : Test cash status line\n # use of the constraint : Test cash status line\n
vliste = transaction.checkConsistency()\n #vliste = transaction.checkConsistency()\n
transaction.log(\'vliste\', vliste)\n #transaction.log(\'vliste\', vliste)\n
if len(vliste) != 0:\n #if len(vliste) != 0:\n
raise ValidationFailed, (vliste[0].getMessage(),)\n # raise ValidationFailed, (vliste[0].getMessage(),)\n
\n \n
\n \n
resource_two = transaction.CashDelivery_checkCounterInventory(caisse_outgoing, portal_type=\'Outgoing Cash Exchange Line\')\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 ...@@ -169,8 +171,9 @@ if amount_total != outgoing_total:\n
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
<string>Message</string> <string>Message</string>
<string>_getattr_</string> <string>_getitem_</string>
<string>transaction</string> <string>transaction</string>
<string>_getattr_</string>
<string>currency</string> <string>currency</string>
<string>encaisse_billets_et_monnaies_sortante</string> <string>encaisse_billets_et_monnaies_sortante</string>
<string>encaisse_billets_et_monnaies_entrante</string> <string>encaisse_billets_et_monnaies_entrante</string>
...@@ -178,9 +181,6 @@ if amount_total != outgoing_total:\n ...@@ -178,9 +181,6 @@ if amount_total != outgoing_total:\n
<string>caisse_incoming</string> <string>caisse_incoming</string>
<string>caisse_outgoing</string> <string>caisse_outgoing</string>
<string>msg</string> <string>msg</string>
<string>vliste</string>
<string>len</string>
<string>_getitem_</string>
<string>resource_two</string> <string>resource_two</string>
<string>incoming_total</string> <string>incoming_total</string>
<string>outgoing_total</string> <string>outgoing_total</string>
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
transaction = state_change.object\n transaction = state_change[\'object\']\n
\n \n
currency = transaction.getResourceTitle()\n currency = transaction.getResourceTitle()\n
encaisse_billets_et_monnaies = "/encaisse_des_billets_et_monnaies/sortante"\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 ...@@ -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 #encaisse_devise = "/encaisse_des_devises/%s/entrante" %(transaction.getResourceTitle().lower())\n
\n \n
counter_site = transaction.getSource()\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 incoming_destination = counter_site + encaisse_devise\n
outgoing_source = counter_site + encaisse_billets_et_monnaies\n outgoing_source = counter_site + encaisse_billets_et_monnaies\n
\n \n
...@@ -180,8 +184,9 @@ elif resource_two!= 0 :\n ...@@ -180,8 +184,9 @@ elif resource_two!= 0 :\n
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
<string>Message</string> <string>Message</string>
<string>_getattr_</string> <string>_getitem_</string>
<string>transaction</string> <string>transaction</string>
<string>_getattr_</string>
<string>currency</string> <string>currency</string>
<string>encaisse_billets_et_monnaies</string> <string>encaisse_billets_et_monnaies</string>
<string>var_ressource_title</string> <string>var_ressource_title</string>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
transaction = state_change.object\n transaction = state_change[\'object\']\n
\n \n
currency = transaction.getResourceTitle()\n currency = transaction.getResourceTitle()\n
\n \n
...@@ -82,6 +82,8 @@ encaisse_billets_et_monnaies = "/encaisse_des_billets_et_monnaies/entrante"\n ...@@ -82,6 +82,8 @@ encaisse_billets_et_monnaies = "/encaisse_des_billets_et_monnaies/entrante"\n
\n \n
counter_site = transaction.getSource()\n counter_site = transaction.getSource()\n
\n \n
# check we don\'t change of user\n
transaction.Baobab_checkSameUserVault(counter_site)\n
\n \n
outgoing_source = counter_site + encaisse_devise\n outgoing_source = counter_site + encaisse_devise\n
\n \n
...@@ -91,10 +93,10 @@ if not transaction.Baobab_checkCounterDateOpen(site=outgoing_source, date=transa ...@@ -91,10 +93,10 @@ if not transaction.Baobab_checkCounterDateOpen(site=outgoing_source, date=transa
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
# use of the constraint : Test cash status line\n # use of the constraint : Test cash status line\n
vliste = transaction.checkConsistency()\n #vliste = transaction.checkConsistency()\n
transaction.log(\'vliste\', vliste)\n #transaction.log(\'vliste\', vliste)\n
if len(vliste) != 0:\n #if len(vliste) != 0:\n
raise ValidationFailed, (vliste[0].getMessage(),)\n # raise ValidationFailed, (vliste[0].getMessage(),)\n
\n \n
\n \n
\n \n
...@@ -176,8 +178,9 @@ elif resource_one != 0 :\n ...@@ -176,8 +178,9 @@ elif resource_one != 0 :\n
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
<string>Message</string> <string>Message</string>
<string>_getattr_</string> <string>_getitem_</string>
<string>transaction</string> <string>transaction</string>
<string>_getattr_</string>
<string>currency</string> <string>currency</string>
<string>var_ressource_title</string> <string>var_ressource_title</string>
<string>encaisse_devise</string> <string>encaisse_devise</string>
...@@ -185,9 +188,6 @@ elif resource_one != 0 :\n ...@@ -185,9 +188,6 @@ elif resource_one != 0 :\n
<string>counter_site</string> <string>counter_site</string>
<string>outgoing_source</string> <string>outgoing_source</string>
<string>msg</string> <string>msg</string>
<string>vliste</string>
<string>len</string>
<string>_getitem_</string>
<string>resource_one</string> <string>resource_one</string>
<string>billetage_entre</string> <string>billetage_entre</string>
<string>billetage_sorti</string> <string>billetage_sorti</string>
......
...@@ -75,6 +75,9 @@ transaction = state_change.object\n ...@@ -75,6 +75,9 @@ transaction = state_change.object\n
vault = transaction.getSource()\n vault = transaction.getSource()\n
date = transaction.getStartDate()\n date = transaction.getStartDate()\n
\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 # check we are in an opened accounting day\n
if not transaction.Baobab_checkCounterDateOpen(site=vault, date=date):\n if not transaction.Baobab_checkCounterDateOpen(site=vault, date=date):\n
msg = Message(domain = "ui", message="Counter Date is not opened")\n msg = Message(domain = "ui", message="Counter Date is not opened")\n
......
...@@ -78,7 +78,9 @@ if transaction.getResource() is None:\n ...@@ -78,7 +78,9 @@ if transaction.getResource() is None:\n
#transaction.Base_checkBaobabSourceAndDestination()\n #transaction.Base_checkBaobabSourceAndDestination()\n
\n \n
date = transaction.getStartDate()\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 \n
lettering = transaction.getGroupingReference()\n lettering = transaction.getGroupingReference()\n
\n \n
......
...@@ -76,10 +76,10 @@ resource = transaction.CashDelivery_checkCounterInventory(source = destination, ...@@ -76,10 +76,10 @@ resource = transaction.CashDelivery_checkCounterInventory(source = destination,
#transaction.log("call to CashDelivery_getCounterInventory return", resource)\n #transaction.log("call to CashDelivery_getCounterInventory return", resource)\n
\n \n
# use of the constraint : Test cash status line\n # use of the constraint : Test cash status line\n
vliste = transaction.checkConsistency()\n #vliste = transaction.checkConsistency()\n
transaction.log(\'vliste\', vliste)\n #transaction.log(\'vliste\', vliste)\n
if len(vliste) != 0:\n #if len(vliste) != 0:\n
raise ValidationFailed, (vliste[0].getMessage(),)\n # raise ValidationFailed, (vliste[0].getMessage(),)\n
\n \n
user_id = transaction.portal_membership.getAuthenticatedMember().getUserName()\n user_id = transaction.portal_membership.getAuthenticatedMember().getUserName()\n
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n
...@@ -171,8 +171,6 @@ elif price != cash_detail:\n ...@@ -171,8 +171,6 @@ elif price != cash_detail:\n
<string>_getattr_</string> <string>_getattr_</string>
<string>destination</string> <string>destination</string>
<string>resource</string> <string>resource</string>
<string>vliste</string>
<string>len</string>
<string>user_id</string> <string>user_id</string>
<string>context</string> <string>context</string>
<string>site_list</string> <string>site_list</string>
......
333 335
\ No newline at end of file \ No newline at end of file
...@@ -14,11 +14,14 @@ Container Line | cash_status ...@@ -14,11 +14,14 @@ Container Line | cash_status
Container Line | emission_letter Container Line | emission_letter
Container Line | variation Container Line | variation
Currency Purchase | currency_exchange_type Currency Purchase | currency_exchange_type
Currency Purchase | source_trade
Currency Sale | currency_exchange_type Currency Sale | currency_exchange_type
Currency Sale | source_trade
Foreign Cash Reception | currency_exchange_type Foreign Cash Reception | currency_exchange_type
Internal Money Deposit | external_software Internal Money Deposit | external_software
Monetary Recall Cell | variation Monetary Recall Cell | variation
Money Deposit | external_software Money Deposit | external_software
Money Deposit | source_trade
Mutilated Banknote | source_decision Mutilated Banknote | source_decision
Mutilated Banknote | source_trade Mutilated Banknote | source_trade
Outgoing Cash Sorting Cell | variation Outgoing Cash Sorting Cell | variation
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<item>site</item> <item>site</item>
</portal_type> </portal_type>
<portal_type id="Check Payment"> <portal_type id="Check Payment">
<item>source_trade</item>
<item>aggregate_resource</item> <item>aggregate_resource</item>
</portal_type> </portal_type>
<portal_type id="Checkbook Delivery"> <portal_type id="Checkbook Delivery">
...@@ -14,12 +15,12 @@ ...@@ -14,12 +15,12 @@
<item>currency_exchange_type</item> <item>currency_exchange_type</item>
</portal_type> </portal_type>
<portal_type id="Checkbook Reception Line"> <portal_type id="Checkbook Reception Line">
<item>check_amount</item>
<item>check_type</item> <item>check_type</item>
<item>check_amount</item>
</portal_type> </portal_type>
<portal_type id="Stop Payment"> <portal_type id="Stop Payment">
<item>aggregate_resource</item>
<item>currency_exchange_type</item> <item>currency_exchange_type</item>
<item>aggregate_resource</item>
</portal_type> </portal_type>
<portal_type id="Traveler Check Purchase"> <portal_type id="Traveler Check Purchase">
<item>currency_exchange_type</item> <item>currency_exchange_type</item>
......
...@@ -65,16 +65,21 @@ ...@@ -65,16 +65,21 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>user_id = context.Base_getLastUserIdByTransition(workflow_id=\'check_payment_workflow\', transition_id=\'deliver_action\')\n <value> <string>source_trade = context.getSourceTrade()\n
if user_id is None:\n if source_trade is None:\n
return None\n user_id = context.Base_getLastUserIdByTransition(workflow_id=\'check_payment_workflow\', transition_id=\'deliver_action\')\n
site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n if user_id is not None:\n
source = context.getSource()\n site_list = context.Baobab_getUserAssignedSiteList(user_id=user_id)\n
for site in site_list:\n source = context.getSource()\n
for site in site_list:\n
site_value = context.portal_categories.getCategoryValue(site)\n site_value = context.portal_categories.getCategoryValue(site)\n
if site_value.getVaultType().endswith(\'guichet\') and source in site:\n if site_value.getVaultType().endswith(\'guichet\') and source in site:\n
return site + \'/encaisse_des_billets_et_monnaies/sortante\'\n source_trade = site + \'/encaisse_des_billets_et_monnaies/sortante\'\n
return None\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> </string> </value>
</item> </item>
<item> <item>
...@@ -126,8 +131,9 @@ return None\n ...@@ -126,8 +131,9 @@ return None\n
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>user_id</string> <string>source_trade</string>
<string>None</string> <string>None</string>
<string>user_id</string>
<string>site_list</string> <string>site_list</string>
<string>source</string> <string>source</string>
<string>_getiter_</string> <string>_getiter_</string>
......
...@@ -78,6 +78,9 @@ if source is None:\n ...@@ -78,6 +78,9 @@ if source is None:\n
msg = Message(domain=\'ui\', message=\'No counter defined.\')\n msg = Message(domain=\'ui\', message=\'No counter defined.\')\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\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 # check we are in an opened accounting day\n
if not transaction.Baobab_checkCounterDateOpen(site=source, date=date):\n if not transaction.Baobab_checkCounterDateOpen(site=source, date=date):\n
msg = Message(domain = "ui", message="Counter Date is not opened")\n msg = Message(domain = "ui", message="Counter Date is not opened")\n
...@@ -199,6 +202,7 @@ if total_credit>0:\n ...@@ -199,6 +202,7 @@ if total_credit>0:\n
<string>item</string> <string>item</string>
<string>category_list</string> <string>category_list</string>
<string>base_price</string> <string>base_price</string>
<string>_inplacevar_</string>
<string>round</string> <string>round</string>
</tuple> </tuple>
</value> </value>
......
268 270
\ No newline at end of file \ No newline at end of file
Check Deposit | site Check Deposit | site
Check Payment | aggregate_resource Check Payment | aggregate_resource
Check Payment | source_trade
Checkbook Delivery Line | check_amount Checkbook Delivery Line | check_amount
Checkbook Delivery Line | check_type Checkbook Delivery Line | check_type
Checkbook Delivery Line | currency_exchange_type Checkbook Delivery Line | currency_exchange_type
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment