OpenERP/Odoo模型关系XML语法
我正在使用OpenERP7.0。 下面的代码来自文件OpenERP/Odoo模型关系XML语法,openerp,odoo-8,Openerp,Odoo 8,我正在使用OpenERP7.0。 下面的代码来自文件addons/project/security/project\u security.xml 请告诉我4、6和0是从哪里来的? 关于这一点,我可以查阅文件中的哪个地方 使用者 经理 对于多个字段,需要一个元组列表。 下面是接受的元组列表,以及相应的语义: (0, 0, { values }) link to a new record that needs to be created with the given values dict
addons/project/security/project\u security.xml
请告诉我4、6和0是从哪里来的?
关于这一点,我可以查阅文件中的哪个地方
使用者
经理
对于多个字段
,需要一个元组列表。
下面是接受的元组列表,以及相应的语义:
(0, 0, { values }) link to a new record that needs to be created with the given values dictionary
(1, ID, { values }) update the linked record with id = ID (write *values* on it)
(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) 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) link to existing record with id = ID (adds a relationship)
(5) unlink all (like using (3,ID) for all linked records)
(6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)
Example:
[(6, 0, [8, 5, 6, 4])] sets the many2many to ids [8, 5, 6, 4]
(0, 0, { values }) link to a new record that needs to be created with the given values dictionary
(1, ID, { values }) update the linked record with id = ID (write *values* on it)
(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)
Example:
[(0, 0, {'field_name':field_value_record1, ...}), (0, 0, {'field_name':field_value_record2, ...})]
对于one2many字段,需要一个元组列表。
下面是接受的元组列表,以及相应的语义:
(0, 0, { values }) link to a new record that needs to be created with the given values dictionary
(1, ID, { values }) update the linked record with id = ID (write *values* on it)
(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) 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) link to existing record with id = ID (adds a relationship)
(5) unlink all (like using (3,ID) for all linked records)
(6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)
Example:
[(6, 0, [8, 5, 6, 4])] sets the many2many to ids [8, 5, 6, 4]
(0, 0, { values }) link to a new record that needs to be created with the given values dictionary
(1, ID, { values }) update the linked record with id = ID (write *values* on it)
(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)
Example:
[(0, 0, {'field_name':field_value_record1, ...}), (0, 0, {'field_name':field_value_record2, ...})]
我希望这能消除你的疑虑
谢谢和问候非常感谢亚辛。你的解释很清楚。如果你让我知道你怎么知道这一点,我会更加感谢你。我希望有官方文件可以让我自己学习这些东西。不管怎样,你的回答已经帮了我很大的忙了d检查Odoo.com上ORM模型和方法下的文档。神奇的数字很奇怪,但确实可以保存代码。感谢阿德里安的指导。我在这里找到的,一旦你尝试了答案,你可以接受它作为一个答案…:-)嗨,亚辛。我最近接受了你的回答。对不起,我正在试着熟悉这个堆栈溢出。