This question has been flagged
1 Reply
3512 Views

Hi same one can explain to me this fragment of sourse

<record id="base.user_demo" model="res.users">
            <field name="groups_id" eval="[(4,ref('base.group_document_user'))]"/> 
    </record>

eval =...

Avatar
Discard
Best Answer

In your code eval means that the enclosed expression will be evaluted by the field object. In this case, it means that the base.group_document_user id will be added to the groups_id of the user with id base.user_demo. The meaning of the code (here 4) is:

 Values: 
     (0, 0,  { fields })    create
     (1, ID, { fields })    update (write fields to ID)
     (2, ID)                remove (calls unlink on ID, that will also delete the 
                            relationship because of the ondelete)
     (3, ID)                unlink (delete the relationship between
                            the two objects but does not delete ID)
     (4, ID)                link (add a relationship)
     (5, ID)                unlink all
     (6, ?, ids)            set a list of links

This is described in the fields.py file and probably somewhere in the documentation, but I could not find it.

Avatar
Discard