Odoo Hilfe

3

0
5 Answers
4
Avatar

Turkesh Patel

--Turkesh Patel--
1600
| 2 2 5
Ahmedabad, Indien
--Turkesh Patel--

Founder of Almighty Consulting Services

Almighty Consulting Services is involved in ERP Implementation, System Administration, Software Development, Website Design, Implementation and Support. We are strongly focused on delivering high-quality modules to our clients and customers. We make sure that we provide the best quality code and service that can satiate client's desired needs.

ERP Solution for

E-commerce Solution for,

Hospitals

Manufacturing Industry

Trading Industry

Education Management

Solutions for SME. A team of AlmightyCS served a many  clients located in different parts of the world.

For Details visit http://www.almightycs.com

Turkesh Patel
28.02.15, 05:01

You can set users using this python code. put that in any method and use that method.

res_groups = self.pool['res.groups']

users = self.pool['res.users'].search(cr, uid, [], context) #if you not want to set group to all user then set proper domain instead of []

group_id = self.pool['ir.model.data'].get_object(cr, uid, 'your_module_name',  'salesmen_commission_group')

res_groups.write(cr, uid, [group_id], {'users': [(4, user) for user in users]}, context=context)

1 Kommentar
Ankit H Gandhi(AHG)
02.11.17, 03:22

Thanks, It's working for me +1

1
Jordan Vrtanoski
28.02.15, 03:40

Here is example of adding the admin user to the group you have created trough the XML:

        <record model="res.groups" id="salesmen_commission_group">
            <field name="name">Commission</field>
            <field name="comment">Salesmen Commission Permission Group.</field>
            <field name="category_id" ref="module_category_commission"/>
            <field name="users" eval="[(4, ref('base.user_root'))]"/>
        </record>

 

0
Daniel Lopez
22.12.17, 16:34

Hi dude,

You can try with this for python

def set_commission_group(self, user_id):
commission_group = self.env.ref('your_module_name.salesmen_commission_group')
commission_group.write({'users': [(4, user_id)]})
0
Gustavo Belduma
08.11.18, 16:10

Hi,

in my case it worked in the following way


@api.multi
def assign_perms(self):
    users_id = [1, 2, 3, 4, 5, .........]
    aux_users = [(4, i) for i in users_id]
    group = self.env['res.groups'].search([('id', '=', self.env.ref('module_name.identifier').id)])
    group.write({'users': aux_users})

Fragen Sie
Writer
Keep Informed
1 Verfolger
About This Community

This platform 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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now