add new function for fetch property data on partner model
authorHarshad Modi <hmo@tinyerp.com>
Fri, 26 Sep 2008 11:12:09 +0000 (16:42 +0530)
committerHarshad Modi <hmo@tinyerp.com>
Fri, 26 Sep 2008 11:12:09 +0000 (16:42 +0530)
bzr revid: hmo@tinyerp.com-20080926111209-g7ij0j5uw8rukri8

bin/addons/base/res/partner/partner.py

index d568032..3c5f539 100644 (file)
@@ -247,6 +247,18 @@ class res_partner(osv.osv):
             result[a] = adr.get(a, default_address)
         return result
 
+    def property_get(self, cr, uid, ids,property_pref=[]):
+        select = ids
+        if isinstance(ids, (int, long)):
+            select = [ids]
+        result=self.read(cr,uid,select,property_pref)
+        for res in result:
+            for prt in property_pref:
+                res[prt] = res[prt] and res[prt][0] or False
+        if isinstance(ids, (int, long)):
+            return result[0]
+        return result
+
     def gen_next_ref(self, cr, uid, ids):
         if len(ids) != 1:
             return True