Commit f4bd2f6f authored by Aurel's avatar Aurel

if we do a destruction in an auxiliairy agency, we must defined the main...

if we do a destruction in an auxiliairy agency, we must defined the main agency for which we are working for

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24555 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2b03093b
...@@ -71,16 +71,16 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n ...@@ -71,16 +71,16 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
\n \n
transaction = state_change[\'object\']\n transaction = state_change[\'object\']\n
transaction.log("transaction", "validateVaultBalance")\n
vault = transaction.getSource()\n
\n \n
source_object = context.portal_categories.getCategoryValue(vault)\n source_object = transaction.getSourceValue()\n
vault = source_object.getPhysicalPath()\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 check_source_counter_date:\n if check_source_counter_date:\n
transaction.Baobab_checkCounterDateOpen(site=source_object, date=transaction.getStartDate())\n transaction.Baobab_checkCounterDateOpen(site=source_object, date=transaction.getStartDate())\n
\n \n
if (\'encaisse_des_externes\' not in vault and \'encaisse_des_billets_retires_de_la_circulation\' not in vault):\n if \'encaisse_des_externes\' not in vault and \\\n
\'encaisse_des_billets_retires_de_la_circulation\' not in vault:\n
msg = Message(domain="ui", message="Invalid source.")\n msg = Message(domain="ui", message="Invalid source.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
...@@ -90,25 +90,28 @@ if \'encaisse_des_externes\' in vault:\n ...@@ -90,25 +90,28 @@ if \'encaisse_des_externes\' in vault:\n
msg = Message(domain="ui", message="Invalid Foreign Agency.")\n msg = Message(domain="ui", message="Invalid Foreign Agency.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
\n if "auxiliaire" in vault and transaction.getSourceSection() in (None, ""):\n
msg = Message(domain="ui", message="You must select a foreign agency.")\n
raise ValidationFailed, (msg,)\n
\n \n
\n \n
# In case of dematerialization, we must have only coins\n # In case of dematerialization, we must have only coins\n
transaction.log("isDematerialization", transaction.isDematerialization())\n
if transaction.isDematerialization():\n if transaction.isDematerialization():\n
for line in transaction.objectValues(portal_type=\'Monetary Destruction Line\'):\n for line in transaction.objectValues(portal_type=\'Monetary Destruction Line\'):\n
transaction.log("line", line.getResourceValue().getPortalType())\n
if line.getResourceValue().getPortalType() != \'Coin\':\n if line.getResourceValue().getPortalType() != \'Coin\':\n
msg = Message(domain="ui", message="Sorry, dematerialization is possible only with coins.")\n msg = Message(domain="ui", message="Sorry, dematerialization is possible only with coins.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n
# Also we must make sure that the source_section is defined\n # Also we must make sure that the source_section is defined\n
source_section = transaction.getSourceSection()\n source_section = transaction.getSourceSection()\n
if source_section is None:\n if source_section is None:\n
msg = Message(domain="ui", message="Sorry, dematerialization is possible only if the external agency is defined.")\n msg = Message(domain="ui", message="Sorry, dematerialization is possible only if the external agency is defined.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
if not \'encaisse_des_billets_retires_de_la_circulation\' in vault:\n \n
if \'encaisse_des_billets_retires_de_la_circulation\' not in vault:\n
msg = Message(domain="ui", message="Invalid source.")\n msg = Message(domain="ui", message="Invalid source.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n
if source_section in source_object.getPath():\n if source_section in source_object.getPath():\n
msg = Message(domain="ui", message="You can\'t used this site.")\n msg = Message(domain="ui", message="You can\'t used this site.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
...@@ -117,7 +120,7 @@ if transaction.isDematerialization():\n ...@@ -117,7 +120,7 @@ if transaction.isDematerialization():\n
# Get price and total_price.\n # Get price and total_price.\n
amount = transaction.getSourceTotalAssetPrice()\n amount = transaction.getSourceTotalAssetPrice()\n
total_price = transaction.getTotalPrice(portal_type=[\'Monetary Destruction Line\',\'Monetary Destruction Cell\'],fast=0)\n total_price = transaction.getTotalPrice(portal_type=[\'Monetary Destruction Line\',\'Monetary Destruction Cell\'],fast=0)\n
resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Monetary Destruction Line\')\n resource = transaction.CashDelivery_checkCounterInventory(source=source_object.getPath(), portal_type=\'Monetary Destruction Line\')\n
\n \n
if resource == 2:\n if resource == 2:\n
msg = Message(domain="ui", message="No Resource.")\n msg = Message(domain="ui", message="No Resource.")\n
...@@ -182,9 +185,8 @@ elif resource <> 0 :\n ...@@ -182,9 +185,8 @@ elif resource <> 0 :\n
<string>_getitem_</string> <string>_getitem_</string>
<string>transaction</string> <string>transaction</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>vault</string>
<string>context</string>
<string>source_object</string> <string>source_object</string>
<string>vault</string>
<string>msg</string> <string>msg</string>
<string>source_section</string> <string>source_section</string>
<string>None</string> <string>None</string>
......
645 646
\ No newline at end of file \ No newline at end of file
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