插入Many2many Odoo(以前的OpenERP)
我正在尝试将值插入 Odoo(以前的 OpenERP)中的 Many2many
或 One2many
关系表字段。您知道如何做到这一点吗?
I'm trying to insert values into a Many2many
or One2many
relation table field in Odoo (former OpenERP). Do you have any idea how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
以下是 stock 模块<的示例/a>:
invoice_line_tax_id
字段是多对多关系,(6, 0,tax_ids)
表示用tax_ids
中的记录替换任何现有记录。因为您正在调用create()
,所以没有任何内容可以替换。完整的选项列表位于文档中对于 osv 类。
Here's an example from the stock module:
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 intax_ids
. Because you're callingcreate()
, there's nothing to replace.A full list of options is in the documentation for the osv class.
您可以将值插入到OpenERP中的多对多关系表中,请看上面的示例
You can insert values into a many-to-many relation table in OpenERP, please look at above example
当我们创建 Many2many 字段时,我们使用了以下语法:
现在您需要通过执行如下查询来插入此关系:
When we create the many2many field then we used this syntax:
Now u need to insert into this relation by execute queries like:
只需将您的 Many2many 字段放入视图(xml 文件)中,运行模块后,您可以看到 Many2many 字段,以便在 GUI 中插入记录
Just put your many2many field in view (xml file) and after running your module you can see many2many field to insert records in your gui
对于在 Many2many 字段中添加数据:
对于在 one2many 字段中添加数据:
For adding data in Many2many field:
For adding data in one2many field: