解释OpenERP7.0中的安全性以及(6,0)和(4)的用途?

解释OpenERP7.0中的安全性以及(6,0)和(4)的用途?,openerp,odoo,openerp-7,odoo-8,Openerp,Odoo,Openerp 7,Odoo 8,我见过这个 eval="[(6, 0, ref('test_security.base_security_access)])]" 及 在OpenERP7.0代码中 6,0和4在安全性方面有什么用途?还有其他类似的组合吗?请解释。(4,ID)表示链接到ID=ID的现有记录,这将向现有记录添加关系 而(6,0,[id])表示替换链接id的列表。首先,它将取消/删除现有ID与该记录的链接,然后使用ID列表中的每个ID链接到现有记录 对于删除现有ID和链接ID,它将删除两个对象之间的关系,但不会使用

我见过这个

eval="[(6, 0, ref('test_security.base_security_access)])]" 

在OpenERP7.0代码中

6,0和4在安全性方面有什么用途?还有其他类似的组合吗?请解释。

(4,ID)
表示链接到ID=ID的现有记录,这将向现有记录添加关系

(6,0,[id])
表示替换链接id的列表。首先,它将取消/删除现有ID与该记录的链接,然后使用ID列表中的每个ID链接到现有记录

对于删除现有ID和链接ID,它将删除两个对象之间的关系,但不会使用
(6,0,[id])


关于更多细节,我最终在ORM write方法中找到了答案

  • 对于多个字段,需要一个元组列表。 下面是接受的元组列表,以及相应的语义:

             (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)
    
             (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)
    
例如: [(6,0[8,5,6,4])]将many2many设置为ids[8,5,6,4]

  • 对于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)
    
             (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)
    
    例如: [(0,0,{'field\'name':field\'value\'record1,…}),(0,0,{'field\'name':field\'value\'record2,…}]

  • 对于manyOne字段,只需使用目标记录的ID,该ID必须已经存在,或者
    False
    删除链接

  • 对于引用字段,使用带有模型名称、逗号和目标对象id的字符串(例如:
    'product.product,5'

    • 选项的完整列表在

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

      (1,ID,{values})用ID=ID(write)更新链接记录 (上面的值)

      (2,ID)删除ID=ID的链接记录(调用取消链接 在ID上,将完全删除该对象,并将其链接作为 嗯)

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

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

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

      (6,0,[id])替换链接id的列表(如使用(5)然后 (4,ID)用于ID列表中的每个ID)


      @Odedra感谢Editi自己在ORM模型编写方法中找到的代码。