odoo中的选择字段选项

时间:2019-05-31 08:08:32

标签: python odoo odoo-12

我必须在一种表单中创建一个新字段,即选择字段。我如何在选择字段中进行选择,从其他模型输入(例如从地点列表中选择地点)。我是否需要为此领域创建一个新模块?我正在使用odoo 12。

注意:odoo新手!

1 个答案:

答案 0 :(得分:2)

Instead of Selection field you have to create a Many2one field.You can define a Many2one field like ,

from odoo import fields

   field_name = fields.Many2one('your.model', string="Field  Name")

In your case, consider you have the places in the model place.place, then you can create the Many2one field in your form like ,

   place_id = fields.Many2one('place.place', string="Place")
相关问题