[IMP] search on code for prod lot

bzr revid: fp@tinyerp.com-20111221222717-thhvlq0ryzl0gzv9
This commit is contained in:
Fabien Pinckaers
2011-12-21 23:27:17 +01:00
+11
View File
@@ -1360,6 +1360,17 @@ class stock_production_lot(osv.osv):
name = '%s [%s]' % (name, record['ref'])
res.append((record['id'], name))
return res
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
args = args or []
ids = []
if name:
ids = self.search(cr, uid, [('prefix', '=', name)] + args, limit=limit, context=context)
if not ids:
ids = self.search(cr, uid, [('name', operator, name)] + args, limit=limit, context=context)
else:
ids = self.search(cr, uid, args, limit=limit, context=context)
return self.name_get(cr, uid, ids, context)
_name = 'stock.production.lot'
_description = 'Production lot'