Commit e19801c1 authored by Vincent Pelletier's avatar Vincent Pelletier

"source" property is a counter, "source_trade" is a site: sort out what...

"source" property is a counter, "source_trade" is a site: sort out what counter relative url should be built out of which property.
Do not assume billets_mutiles as the destination for banknotes, there is also billets_macules, so look up destination on parent object.
Additionnal sanity checks in init script.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15310 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ecf17492
......@@ -65,7 +65,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>destination = "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(context.getSource(),)\n
<value> <string>destination = "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(context.getSourceTrade(),)\n
\n
# If it was sent to headquarters, the destination\n
# must be None\n
......
......@@ -70,10 +70,11 @@
# To do this, the "mutilated" from "caisse_courante/billets_mutiles" are destroyed from erp5 point of view and new ones with state "canceled" are added to "caisse_courante/encaisse_des_billets_et_monnaies".\n
# See ExchangedMutilatedBanknoteLine_getBaobabDestination (those lines are created at "planned" state).\n
\n
if context.getParent().getSimulationState() in (\'finished\', \'delivered\'):\n
mutilated_banknote = context.getParent()\n
if mutilated_banknote.getSimulationState() in (\'finished\', \'delivered\'):\n
return None\n
else:\n
return \'%s/surface/caisse_courante/billets_mutiles\' % (context.getParent().getSource(), )\n
return mutilated_banknote.getDestination()\n
</string> </value>
</item>
<item>
......@@ -126,6 +127,7 @@ else:\n
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>mutilated_banknote</string>
<string>None</string>
</tuple>
</value>
......
......@@ -66,10 +66,12 @@
<item>
<key> <string>_body</string> </key>
<value> <string>user_site = context.Baobab_getUserAssignedRootSiteList()[0]\n
if user_site in (\'\', None):\n
user_counter = context.Baobab_getUserAssignedSiteList()[0]\n
if user_site in (\'\', None) or user_counter in (\'\', None):\n
raise ValueError, "Unable to determine site"\n
else:\n
context.edit(source=user_site, source_trade=user_site)\n
if \'guichet\' not in user_counter:\n
raise ValueError, "You are not assigned to a counter"\n
context.edit(source=user_counter, source_trade=user_site)\n
</string> </value>
</item>
<item>
......@@ -123,6 +125,7 @@ else:\n
<string>_getattr_</string>
<string>context</string>
<string>user_site</string>
<string>user_counter</string>
<string>None</string>
<string>ValueError</string>
</tuple>
......
......@@ -66,7 +66,7 @@
<item>
<key> <string>_body</string> </key>
<value> <string>if context.getSimulationState() == "delivered":\n
return "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(context.getSource(),)\n
return "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" %(context.getSourceTrade(),)\n
else:\n
return None\n
</string> </value>
......
426
\ No newline at end of file
428
\ 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