Commit 886b49e5 authored by Vincent Pelletier's avatar Vincent Pelletier

Clarify "if..elif.." structure checking multiple conditions: split in 2 distinct "if" levels.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17443 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e40e352c
...@@ -78,23 +78,34 @@ emission_letter = context.getEmissionLetter()\n ...@@ -78,23 +78,34 @@ emission_letter = context.getEmissionLetter()\n
\n \n
resource_portal_type = context.getResourceValue().getPortalType()\n resource_portal_type = context.getResourceValue().getPortalType()\n
if resource_portal_type == \'Banknote\':\n if resource_portal_type == \'Banknote\':\n
if cash_status == "to_sort" and emission_letter == "not_defined":\n if emission_letter == "not_defined":\n
if cash_status == "to_sort":\n
# banknote letter \'not defined\' / a trier -> caisse source\n # banknote letter \'not defined\' / a trier -> caisse source\n
source = context.getSource()\n source = context.getSource()\n
if not \'ventilation\' in source:\n if not \'ventilation\' in source:\n
return \'%s/caveau/auxiliaire/encaisse_des_billets_et_monnaies\' %(site,)\n return \'%s/caveau/auxiliaire/encaisse_des_billets_et_monnaies\' %(site,)\n
else:\n else:\n
return \'%s/caveau/auxiliaire/%s\' %(site, \'/\'.join(source.split(\'/\')[-2:]))\n return \'%s/caveau/auxiliaire/%s\' %(site, \'/\'.join(source.split(\'/\')[-2:]))\n
elif emission_letter != site_letter:\n else:\n
# This case is/must be protected by a constraint: a document containing a\n
# line matching this condition must not get validated.\n
# XXX: Maybe we should return None here instead of raising.\n
raise Exception, \'Should not be here\'\n
elif emission_letter == site_letter:\n
if cash_status == "valid":\n
# banknote \'valid\' from same country -> caisse de reserve / billets et monnaies\n
return \'%s/caveau/reserve/encaisse_des_billets_et_monnaies\' %(site,)\n
else:\n
# banknote of any other status from same country -> caisse auxiliaire / billets et monnaies\n
return \'%s/caveau/auxiliaire/encaisse_des_billets_et_monnaies\' %(site,)\n
else: # emission_letter != site_letter\n
if cash_status == "to_sort":\n
# Foreign unsorted banknotes -> salle_de_tri / encaisse externe\n
return \'%s/surface/salle_tri/encaisse_des_externes\' %(site,)\n
else:\n
# external banknote -> caisse auxiliaire / encaisse externe\n # external banknote -> caisse auxiliaire / encaisse externe\n
# banknote letter \'mixed\' -> caisse auxiliaire / encaisse externe\n # banknote letter \'mixed\' -> caisse auxiliaire / encaisse externe\n
return \'%s/caveau/auxiliaire/encaisse_des_externes\' %(site,)\n return \'%s/caveau/auxiliaire/encaisse_des_externes\' %(site,)\n
elif cash_status in ("cancelled", "to_sort"):\n
# banknote \'cancelled\' or \'to_sort\'from same country -> caisse auxiliaire / billets et monnaies\n
return \'%s/caveau/auxiliaire/encaisse_des_billets_et_monnaies\' %(site,)\n
elif cash_status == "valid":\n
# banknote \'valid\' from same country -> caisse de reserve / billets et monnaies\n
return \'%s/caveau/reserve/encaisse_des_billets_et_monnaies\' %(site,)\n
else:\n else:\n
# Coin\n # Coin\n
if cash_status == "valid":\n if cash_status == "valid":\n
...@@ -188,6 +199,7 @@ else:\n ...@@ -188,6 +199,7 @@ else:\n
<string>emission_letter</string> <string>emission_letter</string>
<string>resource_portal_type</string> <string>resource_portal_type</string>
<string>source</string> <string>source</string>
<string>Exception</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
524 527
\ 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