From 76da968c1b1d5e0e75279169ef64bf3910c06889 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Wed, 2 Sep 2009 15:59:12 +0000 Subject: [PATCH] Coins don't have the same constraints on destination that banknotes have. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28757 20353a03-c40f-0410-a6d1-a30d3c3de9de --- ...mentNewNotEmitted_getBaobabDestination.xml | 37 +++++++++++++++++-- bt5/erp5_banking_cash/bt/revision | 2 +- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashMovementNewNotEmitted_getBaobabDestination.xml b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashMovementNewNotEmitted_getBaobabDestination.xml index 7f2c680dc6..4ab11b97de 100644 --- a/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashMovementNewNotEmitted_getBaobabDestination.xml +++ b/bt5/erp5_banking_cash/SkinTemplateItem/portal_skins/erp5_banking_cash/CashMovementNewNotEmitted_getBaobabDestination.xml @@ -70,11 +70,29 @@ destination = context.getDestinationSection()\n context.log(source, destination)\n if source is None or destination is None:\n return None\n -if source.split("/")[-1] == destination.split("/")[-1] or "transit" not in source:\n +\n +has_banknote = 0\n +has_coin = 0\n +\n +for movement in context.getMovementList():\n + resource_portal_type = movement.getResourceValue().getPortalType()\n + if resource_portal_type == \'Coin\':\n + has_coin = 1\n + break\n + elif resource_portal_type == \'Banknote\':\n + has_banknote = 1\n + break\n +\n +if has_banknote == 1:\n + if source.split("/")[-1] == destination.split("/")[-1] or "transit" not in source:\n + destination = "%s/caveau/serre/encaisse_des_billets_neufs_non_emis" % destination\n + else:\n + destination = "%s/caveau/serre/encaisse_des_billets_neufs_non_emis_en_transit_allant_a/%s" % (destination, source.split("/")[-1])\n +elif has_coin == 1:\n destination = "%s/caveau/serre/encaisse_des_billets_neufs_non_emis" % destination\n else:\n - destination = "%s/caveau/serre/encaisse_des_billets_neufs_non_emis_en_transit_allant_a/%s" % (destination, source.split("/")[-1])\n - \n + destination = None\n +\n return destination\n </string> </value> </item> @@ -100,6 +118,14 @@ return destination\n <key> <string>_params</string> </key> <value> <string>*args, **kw</string> </value> </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> <item> <key> <string>errors</string> </key> <value> @@ -131,6 +157,11 @@ return destination\n <string>source</string> <string>destination</string> <string>None</string> + <string>has_banknote</string> + <string>has_coin</string> + <string>_getiter_</string> + <string>movement</string> + <string>resource_portal_type</string> <string>_getitem_</string> </tuple> </value> diff --git a/bt5/erp5_banking_cash/bt/revision b/bt5/erp5_banking_cash/bt/revision index 4ffc0cd9c1..c029c62fca 100644 --- a/bt5/erp5_banking_cash/bt/revision +++ b/bt5/erp5_banking_cash/bt/revision @@ -1 +1 @@ -670 \ No newline at end of file +672 \ No newline at end of file -- 2.30.9