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 @@ ...@@ -65,7 +65,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 \n
# If it was sent to headquarters, the destination\n # If it was sent to headquarters, the destination\n
# must be None\n # must be None\n
......
...@@ -70,10 +70,11 @@ ...@@ -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 # 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 # See ExchangedMutilatedBanknoteLine_getBaobabDestination (those lines are created at "planned" state).\n
\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 return None\n
else:\n else:\n
return \'%s/surface/caisse_courante/billets_mutiles\' % (context.getParent().getSource(), )\n return mutilated_banknote.getDestination()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -126,6 +127,7 @@ else:\n ...@@ -126,6 +127,7 @@ else:\n
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>mutilated_banknote</string>
<string>None</string> <string>None</string>
</tuple> </tuple>
</value> </value>
......
...@@ -66,10 +66,12 @@ ...@@ -66,10 +66,12 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>user_site = context.Baobab_getUserAssignedRootSiteList()[0]\n <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 raise ValueError, "Unable to determine site"\n
else:\n if \'guichet\' not in user_counter:\n
context.edit(source=user_site, source_trade=user_site)\n raise ValueError, "You are not assigned to a counter"\n
context.edit(source=user_counter, source_trade=user_site)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -123,6 +125,7 @@ else:\n ...@@ -123,6 +125,7 @@ else:\n
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>user_site</string> <string>user_site</string>
<string>user_counter</string>
<string>None</string> <string>None</string>
<string>ValueError</string> <string>ValueError</string>
</tuple> </tuple>
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>if context.getSimulationState() == "delivered":\n <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 else:\n
return None\n return None\n
</string> </value> </string> </value>
......
426 428
\ 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