Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
4826 Переглядів

While defining records in security.xml file, we can sometimes see lines similar to:

<field name="categ_ids" eval="[(6,0,[ref('categ_meet1'), ref('categ_meet2')])]"/>

In other places, there are lines like:

<field name="groups" eval="[(4, ref('base.group_portal'))]"/> 

I know there is some concept about implied ids, but I don't know what these numbers mean and how to use them. Can someone please help me understand it?  


Аватар
Відмінити
Найкраща відповідь

See ORM API documentation:


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

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.

(1, id, values)

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

(2, id, _)

removes the record of id id from the set, then deletes it (from the database). Can not be used in 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().

(4, id, _)

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

(5, _, _)

removes all records from the set, equivalent to using the command 3 on every record explicitly. Can not be used on One2many. Can not be used in 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. Can not be used on One2many.

Note

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


Аватар
Відмінити
Автор

Thanks zbik. I will read up on the ORM docs more thoroughly.

Related Posts Відповіді Переглядів Дія
2
жовт. 22
6266
1
груд. 15
6257
2
бер. 24
6396
0
лист. 15
4733
access rights manual Вирішено
1
бер. 15
4993