Odoo Help


Set many2many property via PHP XML-RPC

Ondrej Severa
on 5/12/15, 3:43 PM 2,800 views

I am  trying to create a new customer via XML-RPC. I followed the tutorial here


I am able to create new res.Partner and fill all the contact information. I failed with setting the Tags (category_id). 

$resp = $models->execute_kw($db, $uid, $password, 'res.partner', 'write',

The question is how to set many2many relation using PHP and XML-RPC? I am aware of the API here https://www.odoo.com/documentation/8.0/reference/orm.html#openerp.models.Model.write but there is no description how to call it from PHP.

At least some hint would be enought

Ondrej Severa
on 5/13/15, 8:17 AM
On 5/14/15, 1:54 AM

The JSON for category_id if $tagID == 100 should be:

 "category_id": [[4, [100], 0]]

So I believe that your PHP code should have an additional array() as shown below

$resp = $models->execute_kw($db, $uid, $password, 'res.partner', 'write',

Ondrej Severa
On 5/17/15, 2:39 AM

TO Garry: As I wrote in my question I followed the integration API but there is no tutorial how to set many2many property.

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/12/15, 3:43 PM
Seen: 2800 times
Last updated: 5/23/15, 3:49 AM