From 610f0c6f6af54df3119ff0428e394323f60be472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Wed, 30 Jan 2008 16:32:26 +0000 Subject: [PATCH] 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 --- ...gedMutilatedBanknoteLine_getBaobabDestination.xml | 6 ++---- ...ingMutilatedBanknoteLine_getBaobabDestination.xml | 7 +++---- ...OutgoingMutilatedBanknoteLine_getBaobabSource.xml | 3 +-- .../scripts/CheckTransitionDeliver.xml | 7 ++++++- .../scripts/CheckTransitionFinish.xml | 12 +++++++++++- .../scripts/CheckTransitionPlan.xml | 6 +----- .../mutilated_banknote_workflow/states/planned.xml | 2 -- bt5/erp5_banking_cash/bt/revision | 2 +- 8 files changed, 25 insertions(+), 20 deletions(-) diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ExchangedMutilatedBanknoteLine_getBaobabDestination.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ExchangedMutilatedBanknoteLine_getBaobabDestination.xml index 81dbef4841..9127a349a5 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ExchangedMutilatedBanknoteLine_getBaobabDestination.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/ExchangedMutilatedBanknoteLine_getBaobabDestination.xml @@ -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> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/IncomingMutilatedBanknoteLine_getBaobabDestination.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/IncomingMutilatedBanknoteLine_getBaobabDestination.xml index f418b1f5f8..74d239f599 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/IncomingMutilatedBanknoteLine_getBaobabDestination.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/IncomingMutilatedBanknoteLine_getBaobabDestination.xml @@ -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> diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingMutilatedBanknoteLine_getBaobabSource.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingMutilatedBanknoteLine_getBaobabSource.xml index d149c70a19..89cbd1765b 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingMutilatedBanknoteLine_getBaobabSource.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/OutgoingMutilatedBanknoteLine_getBaobabSource.xml @@ -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> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionDeliver.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionDeliver.xml index 20f95d64bf..9ade204d88 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionDeliver.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionDeliver.xml @@ -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> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionFinish.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionFinish.xml index 1d8aec6c80..186e653ba0 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionFinish.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionFinish.xml @@ -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> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionPlan.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionPlan.xml index b0bc98cc8f..8973fb5623 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionPlan.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/scripts/CheckTransitionPlan.xml @@ -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> diff --git a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/states/planned.xml b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/states/planned.xml index 7fa954ba79..2324809967 100644 --- a/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/states/planned.xml +++ b/bt5/erp5_banking_cash/WorkflowTemplateItem/portal_workflow/mutilated_banknote_workflow/states/planned.xml @@ -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> diff --git a/bt5/erp5_banking_cash/bt/revision b/bt5/erp5_banking_cash/bt/revision index b094da400f..7bfdb2b502 100644 --- a/bt5/erp5_banking_cash/bt/revision +++ b/bt5/erp5_banking_cash/bt/revision @@ -1 +1 @@ -568 \ No newline at end of file +573 \ No newline at end of file -- 2.30.9