[IMP]override name_search method

bzr revid: jpr@tinyerp.com-20140506100853-80b45nx286hw1gfh
This commit is contained in:
Jitendra Prajapati (OpenERP) 2014-05-06 15:38:53 +05:30
parent 41ca72726c
commit 394a525e22
2 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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):