Commit 8478dae5 authored by Aurel's avatar Aurel

auxiliary agency can not do dematerialization

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24585 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6b12a348
...@@ -90,21 +90,6 @@ if \'encaisse_des_externes\' in vault:\n ...@@ -90,21 +90,6 @@ 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
if "principale" not in vault:\n
site = transaction.getSourceSection()\n
if site in (None, ""):\n
msg = Message(domain="ui", message="You must select a foreign agency.")\n
raise ValidationFailed, (msg,)\n
source_country = transaction.Baobab_getCountryForSite(transaction.getSource())\n
site_country = transaction.Baobab_getCountryForSite(site)\n
if \'encaisse_des_externes\' in vault and \\\n
site_country == source_country:\n
msg = Message(domain="ui", message="You must select an agency from a foreign country.") \n
raise ValidationFailed, (msg,)\n
elif \'encaisse_des_billets_retires_de_la_circulation\' in vault and \\\n
site_country != source_country: \n
msg = Message(domain="ui", message="You must select an agency from the same country.") \n
raise ValidationFailed, (msg,)\n
\n \n
# In case of dematerialization, we must have only coins\n # In case of dematerialization, we must have only coins\n
if transaction.isDematerialization():\n if transaction.isDematerialization():\n
...@@ -113,6 +98,11 @@ if transaction.isDematerialization():\n ...@@ -113,6 +98,11 @@ if transaction.isDematerialization():\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 \n
# Not possible from auxiliary agency\n
if \'auxiliaire\' in vault:\n
msg = Message(domain="ui", message="You can\'t do this operation on auxiliary site.")\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
...@@ -126,7 +116,23 @@ if transaction.isDematerialization():\n ...@@ -126,7 +116,23 @@ if transaction.isDematerialization():\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
\n # Check specific for auxiliary agencies\n
elif "principale" not in vault: \n
site = transaction.getSourceSection()\n
if site in (None, ""):\n
msg = Message(domain="ui", message="You must select a foreign agency.")\n
raise ValidationFailed, (msg,)\n
source_country = transaction.Baobab_getCountryForSite(transaction.getSource())\n
site_country = transaction.Baobab_getCountryForSite(site)\n
if \'encaisse_des_externes\' in vault and \\\n
site_country == source_country:\n
msg = Message(domain="ui", message="You must select an agency from a foreign country.") \n
raise ValidationFailed, (msg,)\n
elif \'encaisse_des_billets_retires_de_la_circulation\' in vault and \\\n
site_country != source_country: \n
msg = Message(domain="ui", message="You must select an agency from the same country.") \n
raise ValidationFailed, (msg,)\n
\n
\n \n
# Get price and total_price.\n # Get price and total_price.\n
amount = transaction.getSourceTotalAssetPrice()\n amount = transaction.getSourceTotalAssetPrice()\n
...@@ -201,11 +207,11 @@ elif resource <> 0 :\n ...@@ -201,11 +207,11 @@ elif resource <> 0 :\n
<string>msg</string> <string>msg</string>
<string>source_section</string> <string>source_section</string>
<string>None</string> <string>None</string>
<string>_getiter_</string>
<string>line</string>
<string>site</string> <string>site</string>
<string>source_country</string> <string>source_country</string>
<string>site_country</string> <string>site_country</string>
<string>_getiter_</string>
<string>line</string>
<string>amount</string> <string>amount</string>
<string>total_price</string> <string>total_price</string>
<string>resource</string> <string>resource</string>
......
651 652
\ 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