From 167d999bcfda3f3aaadf62b5d0b582701c5e6c0c Mon Sep 17 00:00:00 2001 From: sebalix Date: Sat, 10 Dec 2016 20:33:45 +0100 Subject: [PATCH] [IMP] base_user_role - Set a default category to associated groups --- base_user_role/__openerp__.py | 1 + base_user_role/data/ir_module_category.xml | 10 ++++++++++ base_user_role/models/role.py | 4 ++++ 3 files changed, 15 insertions(+) create mode 100644 base_user_role/data/ir_module_category.xml diff --git a/base_user_role/__openerp__.py b/base_user_role/__openerp__.py index 0893bc971..13f8eadf6 100644 --- a/base_user_role/__openerp__.py +++ b/base_user_role/__openerp__.py @@ -15,6 +15,7 @@ ], 'data': [ 'security/ir.model.access.csv', + 'data/ir_module_category.xml', 'data/ir_cron.xml', 'views/role.xml', 'views/user.xml', diff --git a/base_user_role/data/ir_module_category.xml b/base_user_role/data/ir_module_category.xml new file mode 100644 index 000000000..77884e743 --- /dev/null +++ b/base_user_role/data/ir_module_category.xml @@ -0,0 +1,10 @@ + + + + + + User roles + + + diff --git a/base_user_role/models/role.py b/base_user_role/models/role.py index 6cbf42b97..15ba46dfb 100644 --- a/base_user_role/models/role.py +++ b/base_user_role/models/role.py @@ -23,6 +23,10 @@ class ResUsersRole(models.Model): 'res.users.role.line', 'role_id', string=u"Users") user_ids = fields.One2many( 'res.users', string=u"Users", compute='_compute_user_ids') + group_category_id = fields.Many2one( + related='group_id.category_id', + default=lambda cls: cls.env.ref( + 'base_user_role.ir_module_category_role').id) @api.multi @api.depends('line_ids.user_id')