odoo 对 many2many one2many的操作

One2many and Many2many use a special “commands” format to manipulate the set of records stored in/associated with the field.

One2many和Many2many使用特殊的“命令”格式来操纵存储在字段中/与字段相关联的记录集。

This format is a list of triplets executed sequentially, where each triplet is a command to execute on the set of records. Not all commands apply in all situations. Possible commands are:

此格式是按顺序执行的三元组列表,其中每个三元组是在记录集上执行的命令。 并非所有命令都适用于所有情况。 可能的命令是:

(0, _, values)

adds a new record created from the provided value dict.

添加从提供的值dict创建的新记录。

 

(1, id, values)

updates an existing record of id id with the values in values. Can not be used in create().

使用值中的值更新 id id的现有记录。 不能在create()中使用。

 

(2, id, _)

removes the record of id id from the set, then deletes it (from the database). Can not be used in create().

从集合中删除 id id的记录,然后删除它(从数据库中)。 不能在create()中使用。

 

(3, id, _)

removes the record of id id from the set, but does not delete it. Can not be used on One2many. Can not be used in create().

从集合中删除 id id的记录,但不删除它。 不能在One2many上使用。 不能在create()中使用。

 

(4, id, _)

adds an existing record of id id to the set. Can not be used on One2many.

将id id的现有记录添加到集合中。 不能在One2many上使用。

 

(5, _, _)

removes all records from the set, equivalent to using the command 3on every record explicitly. Can not be used on One2many. Can not be used in create().

从集合中删除所有记录,相当于在每条记录中明确使用命令3。 不能在One2many上使用。 不能在create()中使用。

 

(6, _, ids)

replaces all existing records in the set by the ids list, equivalent to using the command 5 followed by a command 4 for each id in ids.

替换ids列表中集合中的所有现有记录,相当于使用命令5,后跟命令4,用于id中的每个id。

 

Values marked as _ in the list above are ignored and can be anything, generally 0 or False.

上面列表中标记为_的值将被忽略,可以是任何值,通常为0或False。

转载于:https://my.oschina.net/u/138005/blog/3001427

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值