diff --git a/trytond/ir/ui/menu.py b/trytond/ir/ui/menu.py index 6743b97b23..b1afb892af 100644 --- a/trytond/ir/ui/menu.py +++ b/trytond/ir/ui/menu.py @@ -142,7 +142,7 @@ class UIMenu(OSV): _description = __doc__ def search(self, cursor, user, args, offset=0, limit=2000, order=None, - context=None, count=False): + context=None, count=False, query_string=False): res_user_obj = self.pool.get('res.user') if context is None: context = {} @@ -160,6 +160,8 @@ class UIMenu(OSV): break if count: return len(result) + if query_string: + return (','.join(['%d' for x in result]), result) return result def _get_full_name(self, cursor, user, ids, name, args, context): diff --git a/trytond/osv/fields.py b/trytond/osv/fields.py index 06930ca842..4674878db3 100644 --- a/trytond/osv/fields.py +++ b/trytond/osv/fields.py @@ -498,10 +498,11 @@ class Function(_column): self._symbol_f = lambda x: __builtin__.float(x or 0.0) self._symbol_set = (self._symbol_c, self._symbol_f) - def search(self, cursor, uid, obj, name, args): + def search(self, cursor, user, obj, name, arg, context=None): if not self._fnct_search: return [] - return self._fnct_search(obj, cursor, uid, obj, name, args) + return self._fnct_search(obj, cursor, user, obj, name, arg, + context=context) def get(self, cursor, obj, ids, name, user=None, offset=0, context=None, values=None): diff --git a/trytond/osv/orm.py b/trytond/osv/orm.py index e6c7f134c2..c81520a9fc 100644 --- a/trytond/osv/orm.py +++ b/trytond/osv/orm.py @@ -1893,14 +1893,14 @@ class ORM(object): j += 1 if field._fnct_search: args.extend(field.search(cursor, user, self, - arg[0][0], arg)) + arg[0][0], arg, context=context)) elif field._type == 'one2many': field_obj = self.pool.get(field._obj) if isinstance(args[i][2], basestring): # get the ids of the records of the "distant" resource ids2 = [x[0] for x in field_obj.name_search(cursor, user, - args[i][2], [], args[i][1])] + args[i][2], [], args[i][1], context=context)] else: ids2 = args[i][2] if not ids2: @@ -1924,7 +1924,7 @@ class ORM(object): if isinstance(args[i][2], basestring): ids2 = [x[0] for x in self.pool.get( field._obj).name_search(cursor, user, args[i][2], [], - 'like')] + 'like', context=context)] else: ids2 = args[i][2] @@ -1953,7 +1953,7 @@ class ORM(object): if isinstance(args[i][2], basestring): res_ids = [x[0] for x in self.pool.get(field._obj ).name_search(cursor, user, args[i][2], [], - args[i][1])] + args[i][1], context=context)] else: res_ids = args[i][2] if not len(res_ids): @@ -1973,7 +1973,7 @@ class ORM(object): if isinstance(args[i][2], basestring): ids2 = [x[0] for x in self.pool.get( field._obj).name_search(cursor, user, args[i][2], - [], 'like')] + [], 'like', context=context)] else: ids2 = args[i][2] @@ -1994,7 +1994,8 @@ class ORM(object): else: if isinstance(args[i][2], basestring): res_ids = self.pool.get(field._obj).name_search(cursor, - user, args[i][2], [], args[i][1]) + user, args[i][2], [], args[i][1], + context=context) args[i] = (args[i][0], 'in', [x[0] for x in res_ids], table) else: diff --git a/trytond/wizard/wizard.py b/trytond/wizard/wizard.py index 058f56956c..375b1c7738 100644 --- a/trytond/wizard/wizard.py +++ b/trytond/wizard/wizard.py @@ -234,7 +234,7 @@ class WizardOSV(OSV): pass def search(self, cursor, user, args, offset=0, limit=None, order=None, - context=None, count=False): + context=None, count=False, query_string=False): pass def name_get(self, cursor, user, ids, context=None):