diff --git a/account_usability/models/account_incoterms.py b/account_usability/models/account_incoterms.py index 75f453e..ca2b842 100644 --- a/account_usability/models/account_incoterms.py +++ b/account_usability/models/account_incoterms.py @@ -14,3 +14,13 @@ class AccountIncoterms(models.Model): for rec in self: res.append((rec.id, '[%s] %s' % (rec.code, rec.name))) return res + + @api.model + def name_search(self, name='', args=None, operator='ilike', limit=100): + if args is None: + args = [] + if name and operator == 'ilike': + recs = self.search([('code', '=ilike', name + '%')] + args, limit=limit) + if recs: + return recs.name_get() + return super().name_search(name=name, args=args, operator=operator, limit=limit)