コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
8833 ビュー

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

https://www.odoo.com/documentation/8.0/api_integration.html

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',
    array(array($userID), 
        array('category_id'=>array(4,array($tagID),0))
        ));

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

最善の回答

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',
array(array($userID),
array(array('category_id'=>array(4,array($tagID),0)))
));

アバター
破棄
著作者 最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
2
1月 21
15276
0
8月 23
4848
1
2月 21
11035
4
6月 20
6148
1
2月 19
7621