插入到many2mano odoo(以前的openerp)中 [英] insert into many2many odoo (former openerp)

查看:96
本文介绍了插入到many2mano odoo(以前的openerp)中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将值插入到odoo(以前的OpenERP)中的many2many或one2manhy关系表中.您知道如何执行此操作吗?

I'm trying to insert values into a many2many or one2manhy relation table in odoo (former OpenERP). Do you have any idea how to do this?

推荐答案

以下是 invoice_line_tax_id字段是多对多关系,并且(6, 0, tax_ids)表示将任何现有记录替换为tax_ids中的记录.因为您正在呼叫create(),所以没有什么可替换的.

The invoice_line_tax_id field is a many-to-many relationship, and the (6, 0, tax_ids) means to replace any existing records with those in tax_ids. Because you're calling create(), there's nothing to replace.

对于many2many字段,应该有一个元组列表.这是被接受的元组列表,带有相应的语义

For a many2many field, a list of tuples is expected. Here is the list of tuple that are accepted, with the corresponding semantics

(0, 0, { values })链接到需要使用给定值字典创建的新记录

(0, 0, { values }) link to a new record that needs to be created with the given values dictionary

(1, ID, { values })用id = ID更新链接记录(在上面写 values )

(1, ID, { values }) update the linked record with id = ID (write values on it)

(2, ID)删除并删除ID = ID的链接记录(调用ID上的取消链接,这将完全删除对象以及指向该对象的链接)

(2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)

(3, ID)剪切到id = ID的链接记录的链接(删除两个对象之间的关系,但不删除目标对象本身)

(3, ID) cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)

(4, ID)链接到ID = ID的现有记录(添加关系)

(4, ID) link to existing record with id = ID (adds a relationship)

(5)取消所有链接(例如对所有链接的记录使用(3,ID))

(5) unlink all (like using (3,ID) for all linked records)

(6, 0, [IDs])替换链接的ID列表(例如,对ID列表中的每个ID分别使用(5)然后是(4,ID))

(6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)

这篇关于插入到many2mano odoo(以前的openerp)中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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