User groups creation

Asked by KAKA1.2

I created new user group,I cant see the group (ie created by me ) at customize view for giving the group wise permission for a field

How can i set group permission in the code like

_columns={
                'company_id': fields.many2one('res.company','Company',required=True, readonly=True,groups="base.group_erp_manager,mrp.group_mrp_user" ,states={'draft': [('readonly', False)]}),
              }

is it code is right? not how can i set group permission in the code?..

Can u please help me?

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Vinay Rana (OpenERP)
Solved:
Last query:
Last reply:
Revision history for this message
Best Vinay Rana (OpenERP) (vra-openerp) said :
#1

Hello Satheesh,

You can not assign group like this. You need to define your group first and then when you will assign those created group in other module.You need to used those module name where you defined group before the name.

I am given you following example (You can see this in trunk code) of company_id in account object.

*Trunk Addons ('account/account_view.xml'):
<field name="company_id" groups="base.group_multi_company"/>

group_multi_company = > name of the group
base => Related module where it is defined.

 *Trunk Server('server/bin/addons/base/security/base_security.xml'):
    <record model="res.groups" context="{'noadmin':True}" id="group_multi_company">
        <field name="name">Multi Companies</field>
    </record>

Hope this will help you.
Thanks.

Revision history for this message
Adrianto M.Wijaya (adrianto-wijaya) said :
#2

i have same problem to get the group name in order to customize the permission. where we can define this? because i already create this at administration>user>groups

Revision history for this message
OpenBMS JSC (openbmsjsc) said :
#3

If you use the UI to create a group (or any object) OpenERP will not generate an XML ID for that object (anonymous object). Thus, you cannot use that object's XML ID in any referential syntax. One way to overcome this is to use UI to create your groups, ACLs, etc and then export those objects using base_module_record module. It will generate random XML IDs for your anonymous objects for you. You can then use this XML file to initialize your data, and use those generated XML IDs in your code.

Revision history for this message
KAKA1.2 (satheesh) said :
#4

Thanks Vinay Rana (openerp), that solved my question.