From 394a525e22a2b3dd84e65295d6b6a4788b97f907 Mon Sep 17 00:00:00 2001 From: "Jitendra Prajapati (OpenERP)" Date: Tue, 6 May 2014 15:38:53 +0530 Subject: [PATCH] [IMP]override name_search method bzr revid: jpr@tinyerp.com-20140506100853-80b45nx286hw1gfh --- openerp/addons/base/ir/ir_actions.py | 10 ++++++++++ openerp/addons/base/workflow/workflow.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py index 04500868748..4a3511662c9 100644 --- a/openerp/addons/base/ir/ir_actions.py +++ b/openerp/addons/base/ir/ir_actions.py @@ -1060,6 +1060,16 @@ Launch Manually Once: after having been launched manually, it sets automatically def name_get(self, cr, uid, ids, context=None): return [(rec.id, rec.action_id.name) for rec in self.browse(cr, uid, ids, context=context)] + def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): + if not args: + args = [] + ids = [] + if name: + ids = self.search(cr, user, [('action_id', operator, name)] + args, limit=limit) + else: + ids = self.search(cr, user, args, context=context, limit=limit) + return self.name_get(cr, user, ids, context=context) + def action_launch(self, cr, uid, ids, context=None): """ Launch Action of Wizard""" wizard_id = ids and ids[0] or False diff --git a/openerp/addons/base/workflow/workflow.py b/openerp/addons/base/workflow/workflow.py index 3c7e77330f8..821b1bb6bc9 100644 --- a/openerp/addons/base/workflow/workflow.py +++ b/openerp/addons/base/workflow/workflow.py @@ -127,6 +127,16 @@ class wkf_transition(osv.osv): def name_get(self, cr, uid, ids, context=None): return [(line.id, (line.act_from.name) + '+' + (line.act_to.name)) if line.signal == False else (line.id, line.signal) for line in self.browse(cr, uid, ids, context=context)] + def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): + if not args: + args = [] + ids = [] + if name: + ids = self.search(cr, user, ['|',('act_from', operator, name),('act_to', operator, name)] + args, limit=limit) + else: + ids = self.search(cr, user, args, context=context, limit=limit) + return self.name_get(cr, user, ids, context=context) + wkf_transition() class wkf_instance(osv.osv):