From d2de3b9c3cb3c01b8addc6485ecb4b4c0c27f2a4 Mon Sep 17 00:00:00 2001
From: Nicolas Dumazet <nicolas.dumazet@nexedi.com>
Date: Wed, 28 Jul 2010 02:06:56 +0000
Subject: [PATCH] getQuantityUnit: if category does not exist, return the path
 and not None

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37305 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Amount.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/Document/Amount.py b/product/ERP5/Document/Amount.py
index a32cc5e27e..b47a465cbb 100644
--- a/product/ERP5/Document/Amount.py
+++ b/product/ERP5/Document/Amount.py
@@ -733,8 +733,10 @@ class Amount(Base, Variated):
   security.declareProtected(Permissions.AccessContentsInformation,
       'getQuantityUnit')
   def getQuantityUnit(self):
-    value = self.getQuantityUnitValue()
-    if value is not None:
-      return value.getCategoryRelativeUrl()
-    return None
+    result = self._getDefaultCategoryMembership('quantity_unit')
+    if result is None:
+      resource = self.getResourceValue()
+      if resource is not None:
+        result = resource.getQuantityUnit()
+    return result
 
-- 
2.30.9