Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3648 Lượt xem

ello teamI have one field many2one that I use in one form. However when I try upload a XML with some  value fields its get error because I am trying to upload char in one field that is many2one.Could you help me ?.

cost = fields.Many2one('guimarc.linechargerule', default='',string='')
Ảnh đại diện
Huỷ bỏ

not enough information. Many2one is a relation field, so it is a like a DB foreign key to another model.

Câu trả lời hay nhất

The many2one field needs an integer ID as value, char will throw an error. If you are doing through XML data then I can give you an example.

<record id="module_category" model="model.name">
    <field name="name">Name</field>
</record>

<record id="group_user" model="res.groups">
<field
name="name">User</field>
<field
name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field
name="category_id" ref="module_category"/>
</record>

Here Category id is a many2one field
Ảnh đại diện
Huỷ bỏ