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 @@
<item>
<key> <string>_body</string> </key>
<value> <string>mutilated_banknote = context.getParentValue()\n
mutilated_banknote_source_trade = mutilated_banknote.getSourceTrade(\'\')\n
if \'siege\' not in mutilated_banknote_source_trade and mutilated_banknote.getSimulationState() in (\'finished\', \'delivered\'):\n
return "%s/surface/caisse_courante/encaisse_des_billets_et_monnaies" % (mutilated_banknote_source_trade, )\n
if \'siege\' not in mutilated_banknote.getSourceTrade(\'\') and mutilated_banknote.getSimulationState() in (\'finished\', \'delivered\'):\n
return "%s/encaisse_des_billets_et_monnaies/entrante" % (mutilated_banknote.getSource(), )\n
return None\n
</string> </value>
</item>
......@@ -123,7 +122,6 @@ return None\n
<string>_getattr_</string>
<string>context</string>
<string>mutilated_banknote</string>
<string>mutilated_banknote_source_trade</string>
<string>None</string>
</tuple>
</value>
......
......@@ -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
# See ExchangedMutilatedBanknoteLine_getBaobabDestination (those lines are created at "planned" state).\n
\n
mutilated_banknote = context.getParent()\n
if mutilated_banknote.getSimulationState() in (\'finished\', \'delivered\'):\n
return None\n
else:\n
mutilated_banknote = context.getParentValue()\n
if mutilated_banknote.getSimulationState() == \'stopped\':\n
return mutilated_banknote.getDestination()\n
return None\n
</string> </value>
</item>
<item>
......
......@@ -67,8 +67,7 @@
<key> <string>_body</string> </key>
<value> <string>if context.getSimulationState() == "delivered":\n
return "%s/encaisse_des_billets_et_monnaies/sortante" % (context.getSource(), )\n
else:\n
return None\n
return None\n
</string> </value>
</item>
<item>
......
......@@ -76,12 +76,15 @@ source = ob.getSource()\n
\n
# check we are in an opened accounting day\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
\n
# check again that the counter is open\n
context.Baobab_checkCounterOpened(source)\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
msg = Message(domain = "ui", message="You must defined returned banknote.")\n
raise ValidationFailed, (msg,)\n
......@@ -152,6 +155,8 @@ elif resource <> 0 :\n
<string>vault</string>
<string>date</string>
<string>context</string>
<string>_getiter_</string>
<string>outgoing_line</string>
<string>len</string>
<string>msg</string>
<string>resource</string>
......
......@@ -69,12 +69,18 @@
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
from DateTime import DateTime\n
\n
ob = state_change[\'object\']\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
\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
msg = Message(domain = "ui", message="Exchanged amount must be defined on document.")\n
raise ValidationFailed, (msg,)\n
......@@ -137,10 +143,14 @@ if exchanged_mutilated_banknote_total_price != ob.getDestinationTotalAssetPrice(
<string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>DateTime</string>
<string>_getitem_</string>
<string>ob</string>
<string>_getattr_</string>
<string>today</string>
<string>context</string>
<string>_getiter_</string>
<string>exchanged_line</string>
<string>msg</string>
<string>len</string>
<string>exchanged_mutilated_banknote_total_price</string>
......
......@@ -69,10 +69,6 @@
from Products.ERP5Type.Message import Message\n
\n
ob = state_change[\'object\']\n
ob.Baobab_checkCounterDateOpen(site=ob.getSource(), date=ob.getStartDate())\n
\n
\n
\n
\n
# check presence of banknote\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
<string>Message</string>
<string>_getitem_</string>
<string>ob</string>
<string>_getattr_</string>
<string>len</string>
<string>_getattr_</string>
<string>msg</string>
</tuple>
</value>
......
......@@ -37,8 +37,6 @@
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>archive</string>
<string>archive_action</string>
<string>cancel</string>
<string>cancel_action</string>
<string>finish</string>
......
568
\ No newline at end of file
573
\ 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