twtrubiks / odoo-demo-addons-tutorial

學習 odoo , 本文章會持續更新
135 stars 59 forks source link

當你更新 One2many 和 Many2many 時, 要使用比較特別的語言,我之後會補充上來. #5

Closed jackadam1981 closed 2 years ago

jackadam1981 commented 2 years ago

當你更新 One2many 和 Many2many 時, 要使用比較特別的語言,我之後會補充上來.

用到了,还没更新。

jackadam1981 commented 2 years ago

多对多关系的删除。

twtrubiks commented 2 years ago

請參考 odoo 手把手教學 - 使用 python 增加取代 One2many M2X record - part8

以及 這篇底下的

(0, _ , {'field': value}) creates a new record and links it to this one.
(1, id, {'field': value}) updates the values on an already linked record.
(2, id, _) removes the link to and deletes the id related record.
(3, id, _) removes the link to, but does not delete, the id related record. This is usually what you will use to delete related records on many-to-many fields.
(4, id, _) links an already existing record.
(5, _, _) removes all the links, without deleting the linked records.
(6, _, [ids]) replaces the list of linked records with the provided list.
jackadam1981 commented 2 years ago

谢谢