i want to use name_search in product to get product by search the lot name which in stock.production.lot
class ProductProduct(models.Model):
_inherit = 'product.product'
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
args = args or []
print('arg ',args)
recs = self.search([('lot_name', operator, name)] args, limit=limit) #stock_quant_ids.lot_id.name
print('recs ', recs)
if not recs.ids:
return super(ProductProduct, self).name_search(name=name, args=args,
operator=operator,
limit=limit)
return recs.name_get()
When should you use name_search method: https://goo.gl/7PHhPP