KERNEL: fix search on fields function of type one2many, many2many
authorced <>
Wed, 20 Jun 2007 07:12:51 +0000 (07:12 +0000)
committerced <>
Wed, 20 Jun 2007 07:12:51 +0000 (07:12 +0000)
bzr revid: ced-40c3614244f9343240bee07535dcfc15562b38a9

bin/osv/orm.py

index d058ef0..d06c069 100644 (file)
@@ -1390,7 +1390,18 @@ class orm(object):
                                else:
                                        i+=1
                                        continue
-                       if field._type=='one2many':
+                       if field._properties:
+                               arg = [args.pop(i)]
+                               j = i
+                               while j<len(args):
+                                       if args[j][0]==arg[0][0]:
+                                               arg.append(args.pop(j))
+                                       else:
+                                               j+=1
+                               if field._fnct_search:
+                                       args.extend(field.search(cr, user, self, arg[0][0], arg))
+
+                       elif field._type=='one2many':
                                field_obj = self.pool.get(field._obj)
 
                                # get the ids of the records of the "distant" resource
@@ -1453,16 +1464,6 @@ class orm(object):
                                        else:
                                                args[i] += (table,)
                                i+=1
-                       elif field._properties:
-                               arg = [args.pop(i)]
-                               j = i
-                               while j<len(args):
-                                       if args[j][0]==arg[0][0]:
-                                               arg.append(args.pop(j))
-                                       else:
-                                               j+=1
-                               if field._fnct_search:
-                                       args.extend(field.search(cr, user, self, arg[0][0], arg))
                        else:
                                if field.translate and context.get('lang', False) and context['lang'] != 'en_US':
                                        if args[i][1] in ('like', 'ilike'):