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.

0

[SOLVED] Groups definition using XML.

By
Pau Ubach
on 10/24/14, 5:59 AM 790 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.

1

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

there is only 10 kind of people the ones that understand binary ... and others

Bole
On 10/24/14, 8:55 AM

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 

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

Pau Ubach
on 10/26/14, 9:31 PM

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

Bole
on 10/27/14, 3:30 AM

Very useful to know. Thanks.

Pau Ubach
on 10/27/14, 3:31 AM

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: 10/24/14, 5:59 AM
Seen: 790 times
Last updated: 3/16/15, 8:10 AM