我需要关于XMLRPC的帮助,我正在使用python,我试图创建产品变体,并且我需要为字段many2many指定值,这里是我的代码Odoo 8 Python如何分配Many2many或one2many XMLRPC创建对象
idProductLineAttributeLine =
models.execute_kw(db,uid,password,'product.attribute.line','create',
[{'product_tmpl_id':idProduct,'attribute_id':idAttr,'value_ids': (6,0,
[idValue])}])
如果我分配领域的正常工作,万物罚款,但是当涉及到many2many场或one2many领域的显示箭头这样
in __dump\nTypeError: cannot marshal <type 'builtin_function_or_method'> objects\n", "message": "cannot marshal <type 'builtin_function_or_method'> objects", "name": "exceptions.TypeError", "arguments": ["cannot marshal <type 'builtin_function_or_method'> objects"]}}}
我做了什么错?请帮我:)谢谢在先进
在书中odoo必不可少的说,我必须使用这一个了分配many2many值或one2many值,但仍然没有运气
(0,_ ,{' field': value}): This creates a new record and links it to this one
(1, id,{' field': value}): This updates values on an already linked record
(2, id,_): This unlinks and deletes a related record
(3, id,_): This unlinks but does not delete a related record
(4, id,_): This links an already existing record
(5,_,_): This unlinks but does not delete all linked records
(6,_,[ ids]): This replaces the list of linked records with the provided list
更新 我管理通过添加[] THX解决这个问题dccdany指出这一点:)和产品变形加入到产品
models.execute_kw(db,uid,password,'product.attribute.line','create', [{'product_tmpl_id':idProduct,'attribute_id':idAttr,'value_ids': (6,0, [idValue])}])
,但产品变形不会自动产生,我仍然东东d通过编辑手动刷新产品并保存任何想法为什么?
所看到的截图有4个产品变异,但近顶部的状态正确只说3变体没有我在这里错过了什么?
你试过[(6,0,[ids])]吗? – dccdany
啊我看到我做到了,以及如何更新当前many2many关系?我的意思是如果我想添加更多的价值many2many关系而不更换值,因为如果我尝试使用[(6,0,[ids])]?它不断更换以前的值可以举一些例子??如何使用(0,0,{}) – dmh
您可以通过ID和4:[(4,ID)] – dccdany