account_usability: add name_search() on account.incoterms
This commit is contained in:
@@ -14,3 +14,13 @@ class AccountIncoterms(models.Model):
|
|||||||
for rec in self:
|
for rec in self:
|
||||||
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
|
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
|
||||||
return res
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user