İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
3647 Görünümler

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='')
Avatar
Vazgeç

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

En İyi Yanı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
Avatar
Vazgeç