Skip to Content
Menu
This question has been flagged
4269 Views

Hello everybody!!

May any one help me know please how to override the function _name_search of product.product.

I have tried this but not working.

I have a field in product.product called REF and i want to search on it.

Thanks a lot in advance.

@api.model
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
args = args or []
recs = self.browse()
if name:
recs = self.search([('ref', '=like', name)] + args, limit=limit)
if not recs:
recs = self.search([('name', operator, name)] + args, limit=limit)
return recs.name_get()
Avatar
Discard
Related Posts Replies Views Activity
4
May 24
10071
1
Apr 24
1562
0
Nov 23
525
1
Sep 23
565
2
Aug 23
2424