name_get() , 默认计算 display_name 的值
@api.multi
def name_get(self):
res = []
demo = self._context.get('demo', False)
for record in self:
name = record.name
if demo and record.id2:
name += "[示例:%s, 示例:%s]" % (record.id1, record.id2)
else:
if demo:
name += "[示例:%s]" % record.id1
if record.id2:
name += "[示例:%s]" % record.id2
res.append((record.id, name))
return res
name_search, 通过名称和引用查找记录
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
return super(StockProductionLot, self).name_search(name, args, operator, limit)
可参考订单明细选择时,下拉框显示的产品