diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2011-12-21 23:27:17 +0100 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2011-12-21 23:27:17 +0100 |
| commit | c0380d53d3c84a0faf1d4c4ccb249e8be4b77cf3 (patch) | |
| tree | c50956e54361daf4d6f77c20c197264afd8e0a34 | |
| parent | c6fd3fbfa21baeb9a9d8b83d48cf6862b1413945 (diff) | |
| parent | c8a392ebcc61122a8b768ee6c91a2dc203c32b4e (diff) | |
[IMP] search on code for prod lot
bzr revid: fp@tinyerp.com-20111221222717-thhvlq0ryzl0gzv9
| -rw-r--r-- | addons/stock/stock.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/addons/stock/stock.py b/addons/stock/stock.py index e3d3a3be1cb..a1a0cbc3fca 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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' |
