在odoo 9中使用name_get [英] Use name_get in odoo 9
本文介绍了在odoo 9中使用name_get的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何连接Many2one字段,打开下拉列表所有车都可见.我需要[id]和[name].
How to concatenate Many2one field, open drop down list all car is visible. I need [id] and [name].
例如:
[01]奥迪,
[02]宝马
car_id = fields.Many2one('my.cars', 'Cars')
@api.multi
def name_get(self):
???
推荐答案
尝试以下操作:
@api.multi
def name_get(self):
result = []
for record in self:
name = '[' + str(record.id) + ']' + ' ' + record.name
result.append((record.id, name))
return result
注意:
name_get()方法.
这篇关于在odoo 9中使用name_get的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文