From bbc25e7ce85aa36c4876ddc1ec1e72ed919b5dfe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 5 Feb 2007 14:46:41 +0000
Subject: [PATCH] fallback to preferred currency if the current organisation
 doesn't define a price_currency. Thanks Bartek.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12551 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_accounting/Base_getCurrencyForSection.xml          | 6 +++---
 bt5/erp5_accounting/bt/revision                             | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getCurrencyForSection.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getCurrencyForSection.xml
index 4a8eff0aa9..5a8e2ffca2 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getCurrencyForSection.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getCurrencyForSection.xml
@@ -80,15 +80,15 @@ def getCurrencyForSection(section_url):\n
   portal = context.getPortalObject()\n
   section = portal.portal_categories.restrictedTraverse(section_url)\n
 \n
-  if section.getPortalType() == \'Organisation\':\n
+  if section.getPortalType() == \'Organisation\' and section.getPriceCurrency():\n
     return section.getPriceCurrency()\n
 \n
   if section.getPortalType() == \'Category\':\n
     member_list = section.getGroupRelatedValueList(portal_type=\'Organisation\')\n
-    if len(member_list) == 1:\n
+    if len(member_list) == 1 and member_list[0].getPriceCurrency():\n
       return member_list[0].getPriceCurrency()\n
     mapping = section.getMappingValue(portal_type=\'Organisation\')\n
-    if mapping is not None:\n
+    if mapping is not None and mapping.getPriceCurrency():\n
       return mapping.getPriceCurrency()\n
 \n
   # nothing found ... returns the currency from preferences.\n
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index 7b27b25197..4a8d924028 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-173
\ No newline at end of file
+174
\ No newline at end of file
-- 
2.30.9