This question has been flagged
1 Reply
9182 Views

I want to create groups when installing my module:

        <record id="bdt_group_dpc" model="res.groups">
            <field name="name">Users: DPC</field>
            <field name="category_id" eval="bdt_category_department"/>
        </record>

Then I can add access rights:

            <record id="bdt_access_bdd_res_partner_currency" model="ir.model.access">
                <field name="name">res partner currency</field>
                <field name="model_id" ref="request_project.model_res_partner_currency"/>
                <field name="perm_read">1</field>
                <field name="perm_write">1</field>
                <field name="perm_unlink">1</field>
                <field name="perm_create">1</field>
                <field name="group_id" eval="bdt_group_bdd"/>
            </record>

But I don't know how to add rows in inherited tab.

It is used implied_ids, but this is defined in an object (that inherits from res_groups) without field _name and it's in the table res_groups_implied_ids, but I don't know how to add anything there.

 

Actually my problem is with all many2many fields. I don't know how to access the relation table.

Avatar
Discard
Best Answer

use the same fdorm as in python code, only here you need to eval the expression.. like:

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

 

hope it helps

p.s.

check xml files in security folders of bigger modules/aplications and look for examples 

Avatar
Discard
Author

Thank you!! By the way, do you know why does it have number 4? What does it mean?

jes, it creates link to existing record with external id bdt_group_dpc... find more in fields definitions, look for many2many field and write method... it expects some tuples... in wich the first number defines type of write action to do... 0 creates new record... etc

Author

Very useful to know. Thanks.