使用odoo 8中的Web服务API将记录创建到many2many表中 [英] Create a record into many2many table using Web service API in odoo 8

查看:141
本文介绍了使用odoo 8中的Web服务API将记录创建到many2many表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Web服务API在message_id和user_id字段中的mail_vote表(many2many)中创建一条记录.我在这里找到了一个文档:.

I need to create a record in mail_vote table(many2many) with fields message_id and user_id Using Web service API. I found a document here: .

推荐答案

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

Below i am posting the code snippet for associating (6,0,[ids])] the Many2many record in product.attribute.line.

在Php中,我已使用ripcord来完成此任务.

$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

这就是我关联value_ids ['value_ids'=>array(array(6,0,array($existing_value_id)))]的记录的方式.

So this is how i associated a records for value_ids ['value_ids'=>array(array(6,0,array($existing_value_id)))].

在python中,我已经使用xmlrpclib来完成此任务.

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

希望这对您有帮助

这篇关于使用odoo 8中的Web服务API将记录创建到many2many表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆