Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

What is the meaning of the "4" in the expression eval="[(4, ref('base.group_user'))]"

By
Tarek Mohamed Ibrahim
on 5/4/15, 4:45 AM 1,636 views

Hello,

In the definition of the mrp.group_mrp_user I found the expression eval="[(4, ref('base.group_user'))]", I found that this expression is used in other several places, sometimes using the numbers 3 or 6 instead of 4, I need to understand the meaning of this 4 in this expression, thx in advance for enlightment

Here is the definition of the mrp.group_mrp_user:

<record id="group_mrp_user" model="res.groups">

<field name="name">User</field>

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

<field name="category_id" ref="base.module_category_manufacturing"/>

</record>

2

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 5/4/15, 5:07 AM

See documentation. [(4, ref('base.group_user'))] - link to existing record with id = ref('base.group_user'), adds a relationship. 

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/4/15, 4:45 AM
Seen: 1636 times
Last updated: 7/5/16, 5:37 AM