使用 odoo 8 中的 Web 服务 API 在 many2many table 中创建一条记录

Create a record into many2many table using Web service API in odoo 8

我需要使用 Web 服务 API 在 mail_vote table(many2many) 中创建一个包含字段 message_id 和 user_id 的记录。我在这里找到了一份文件:https://www.odoo.com/documentation/8.0/reference/orm.html#openerp.models.Model.write . But i don't know how to use that in my code. Any solution please.

下面我将发布用于关联 (6,0,[ids])] product.attribute.line 中的 Many2many 记录的代码片段。

In Php here i have used ripcord for this task.

$existing_prodid = 59;
$existing_attribute_id = 2;
$existing_value_id = 4;
$product_attribute_line = $models->execute($db, $uid, $password,
                                   'product.attribute.line','create',
                                    array('product_tmpl_id' => $existing_prodid;,
                                        'attribute_id'=>$existing_attribute_id,
                                        'value_ids'=>array(array(6,0,array($existing_value_id)))
                                             ))

这里 product.attribute.lineproduct.attribute.value

有 Many2many 关系

这就是我为 value_ids ['value_ids'=>array(array(6,0,array($existing_value_id)))].

关联记录的方式

In python i have used xmlrpclib for this task.

attibute_line = models.execute_kw(dbname, uid, password,
                   'product.attribute.line', 'create',
                   [{'product_tmpl_id':59,'attribute_id':2,'value_ids':[(6,0,[4])]}] )

我希望这对你的情况有所帮助