Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

how to make many2many records in xml data serialization?

By
Iain Duncan
on 1/1/14, 9:42 PM 1,474 views

Hi folks, I'm trying to create some db records using xml and can't find any examples on how to create many2many relations. I want to do something like this:

<record model="product.product" id="product_1"> <field name="name">Product 1</field> <field name="product_component_ids" ref="component_id"/> </record>

Thanks! iain

0

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

there is only 10 kind of people the ones that understand binary ... and others

Bole
On 6/29/15, 5:08 AM

for m2m value in xml use syntax:


<field name="your_field" eval="[(6, 0, [ ref('module_name.external_id_1'), ref('module_name.external_id_2')])]"/>

or 

<field name="your_field" eval="[(0, 0, [ {'field_1':value_1, 'field_2':value_2}] )]"/>

hoep it helps...

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 1/1/14, 9:42 PM
Seen: 1474 times
Last updated: 6/29/15, 5:09 AM