From 569af073c1d95c3a1885d8a916ed246e4ae7354f Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 2 Jun 2010 13:18:26 +0200 Subject: [PATCH] [IMP] ir_model: name_search working on model description *and* model name bzr revid: odo@openerp.com-20100602111826-v3qbiv65t1mq3np8 --- bin/addons/base/ir/ir_model.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 888432e7968..f13d8e188fe 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -68,6 +68,17 @@ class ir_model(osv.osv): _constraints = [ (_check_model_name, 'The Object name must start with x_ and not contain any special character !', ['model']), ] + + # overridden to allow searching both on model name (model field) + # and model description (name field) + def name_search(self, cr, uid, name='', args=None, operator='ilike', context=None, limit=None): + if args is None: + args = [] + domain = args + ['|', ('model', operator, name), ('name', operator, name)] + return super(ir_model, self).name_search(cr, uid, None, domain, + operator=operator, limit=limit, context=context) + + def unlink(self, cr, user, ids, context=None): for model in self.browse(cr, user, ids, context): if model.state <> 'manual':