Commit 610f0c6f authored by Aurel's avatar Aurel

Update line's destinations: exchanged multilated banknotes end up on counter's...

Update line's destinations: exchanged multilated banknotes end up on counter's vault, not in a general vault.
Fix states in which line's destinations are not None (incomming banknotes were kept for too long in incomming vault).
Remove a missplaced (and duplicated) workflow transition.
Set start dates on exchanged and outgoing lines.
Set stop date on main document.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18929 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cb829b8f
...@@ -66,9 +66,8 @@ ...@@ -66,9 +66,8 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>mutilated_banknote = context.getParentValue()\n <value> <string>mutilated_banknote = context.getParentValue()\n
mutilated_banknote_source_trade = mutilated_banknote.getSourceTrade(\'\')\n if \'siege\' not in mutilated_banknote.getSourceTrade(\'\') and mutilated_banknote.getSimulationState() in (\'finished\', \'delivered\'):\n
if \'siege\' not in mutilated_banknote_source_trade and mutilated_banknote.getSimulationState() in (\'finished\', \'delivered\'):\n return "%s/encaisse_des_billets_et_monnaies/entrante" % (mutilated_banknote.getSource(), )\n
return "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" % (mutilated_banknote_source_trade, )\n
return None\n return None\n
</string> </value> </string> </value>
</item> </item>
...@@ -123,7 +122,6 @@ return None\n ...@@ -123,7 +122,6 @@ return None\n
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>mutilated_banknote</string> <string>mutilated_banknote</string>
<string>mutilated_banknote_source_trade</string>
<string>None</string> <string>None</string>
</tuple> </tuple>
</value> </value>
......
...@@ -70,11 +70,10 @@ ...@@ -70,11 +70,10 @@
# 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
mutilated_banknote = context.getParent()\n mutilated_banknote = context.getParentValue()\n
if mutilated_banknote.getSimulationState() in (\'finished\', \'delivered\'):\n if mutilated_banknote.getSimulationState() == \'stopped\':\n
return None\n
else:\n
return mutilated_banknote.getDestination()\n return mutilated_banknote.getDestination()\n
return None\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -67,8 +67,7 @@ ...@@ -67,8 +67,7 @@
<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/encaisse_des_billets_et_monnaies/sortante" % (context.getSource(), )\n return "%s/encaisse_des_billets_et_monnaies/sortante" % (context.getSource(), )\n
else:\n return None\n
return None\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -76,12 +76,15 @@ source = ob.getSource()\n ...@@ -76,12 +76,15 @@ source = ob.getSource()\n
\n \n
# check we are in an opened accounting day\n # check we are in an opened accounting day\n
vault = \'%s/encaisse_des_billets_et_monnaies/sortante\' % (source, )\n vault = \'%s/encaisse_des_billets_et_monnaies/sortante\' % (source, )\n
date = ob.getStartDate()\n date = ob.getStopDate()\n
ob.Baobab_checkCounterDateOpen(site=vault, date=date)\n ob.Baobab_checkCounterDateOpen(site=vault, date=date)\n
\n \n
# check again that the counter is open\n # check again that the counter is open\n
context.Baobab_checkCounterOpened(source)\n context.Baobab_checkCounterOpened(source)\n
\n \n
for outgoing_line in ob.objectValues(portal_type="Outgoing Mutilated Banknote Line"):\n
outgoing_line.setStartDate(date)\n
\n
if len(ob.objectValues(portal_type="Outgoing Mutilated Banknote Line")) == 0:\n if len(ob.objectValues(portal_type="Outgoing Mutilated Banknote Line")) == 0:\n
msg = Message(domain = "ui", message="You must defined returned banknote.")\n msg = Message(domain = "ui", message="You must defined returned banknote.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
...@@ -152,6 +155,8 @@ elif resource <> 0 :\n ...@@ -152,6 +155,8 @@ elif resource <> 0 :\n
<string>vault</string> <string>vault</string>
<string>date</string> <string>date</string>
<string>context</string> <string>context</string>
<string>_getiter_</string>
<string>outgoing_line</string>
<string>len</string> <string>len</string>
<string>msg</string> <string>msg</string>
<string>resource</string> <string>resource</string>
......
...@@ -69,12 +69,18 @@ ...@@ -69,12 +69,18 @@
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
from DateTime import DateTime\n
\n \n
ob = state_change[\'object\']\n ob = state_change[\'object\']\n
\n \n
ob.Baobab_checkCounterDateOpen(site=ob.getSource(), date=ob.getStartDate())\n today = DateTime().Date()\n
ob.setStopDate(today)\n
ob.Baobab_checkCounterDateOpen(site=ob.getSource(), date=ob.getStopDate())\n
context.Baobab_checkCounterOpened(ob.getSource())\n context.Baobab_checkCounterOpened(ob.getSource())\n
\n \n
for exchanged_line in ob.objectValues(portal_type=\'Exchanged Mutilated Banknote Line\'):\n
exchanged_line.setStartDate(today)\n
\n
if ob.getDestinationTotalAssetPrice() == 0:\n if ob.getDestinationTotalAssetPrice() == 0:\n
msg = Message(domain = "ui", message="Exchanged amount must be defined on document.")\n msg = Message(domain = "ui", message="Exchanged amount must be defined on document.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
...@@ -137,10 +143,14 @@ if exchanged_mutilated_banknote_total_price != ob.getDestinationTotalAssetPrice( ...@@ -137,10 +143,14 @@ if exchanged_mutilated_banknote_total_price != ob.getDestinationTotalAssetPrice(
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
<string>Message</string> <string>Message</string>
<string>DateTime</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>ob</string> <string>ob</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>today</string>
<string>context</string> <string>context</string>
<string>_getiter_</string>
<string>exchanged_line</string>
<string>msg</string> <string>msg</string>
<string>len</string> <string>len</string>
<string>exchanged_mutilated_banknote_total_price</string> <string>exchanged_mutilated_banknote_total_price</string>
......
...@@ -69,10 +69,6 @@ ...@@ -69,10 +69,6 @@
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
\n \n
ob = state_change[\'object\']\n ob = state_change[\'object\']\n
ob.Baobab_checkCounterDateOpen(site=ob.getSource(), date=ob.getStartDate())\n
\n
\n
\n
\n \n
# check presence of banknote\n # check presence of banknote\n
if len(ob.objectValues(portal_type="Exchanged Mutilated Banknote Line")) != 0:\n if len(ob.objectValues(portal_type="Exchanged Mutilated Banknote Line")) != 0:\n
...@@ -127,8 +123,8 @@ if len(ob.objectValues(portal_type="Exchanged Mutilated Banknote Line")) != 0:\n ...@@ -127,8 +123,8 @@ if len(ob.objectValues(portal_type="Exchanged Mutilated Banknote Line")) != 0:\n
<string>Message</string> <string>Message</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>ob</string> <string>ob</string>
<string>_getattr_</string>
<string>len</string> <string>len</string>
<string>_getattr_</string>
<string>msg</string> <string>msg</string>
</tuple> </tuple>
</value> </value>
......
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
<key> <string>transitions</string> </key> <key> <string>transitions</string> </key>
<value> <value>
<tuple> <tuple>
<string>archive</string>
<string>archive_action</string>
<string>cancel</string> <string>cancel</string>
<string>cancel_action</string> <string>cancel_action</string>
<string>finish</string> <string>finish</string>
......
568 573
\ 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