[IMP]mrp : added a name_search method in mrp.bom object for serch via code and product name

bzr revid: mma@tinyerp.com-20121017090536-6mejdgejv8dtmqeh
This commit is contained in:
Mayur Maheshwari (OpenERP)
2012-10-17 14:35:36 +05:30
parent f006171ab3
commit 71f65114cd
+9
View File
@@ -148,6 +148,15 @@ class mrp_bom(osv.osv):
res.append((record['id'], name))
return res
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
if context is None:
context = {}
ids = self.search(cr, user, [('code', '=', name)]+ args, limit=limit, context=context)
ids += self.search(cr, user, [('product_id.name',operator,name)] + args, limit=limit, context=context)
return self.name_get(cr, user, ids, context)
def _child_compute(self, cr, uid, ids, name, arg, context=None):
""" Gets child bom.
@param self: The object pointer