From 456df8eab7bcdb7fdd4aca11933ec3027a36c600 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 | 12 ++++++++++++ base_user_role/models/role.py | 6 ++++++ 3 files changed, 19 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 1482f0b53..cad49b7bf 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..53a51f9a8 --- /dev/null +++ b/base_user_role/data/ir_module_category.xml @@ -0,0 +1,12 @@ + + + + + + + User roles + + + + diff --git a/base_user_role/models/role.py b/base_user_role/models/role.py index 6cbf42b97..861539b85 100644 --- a/base_user_role/models/role.py +++ b/base_user_role/models/role.py @@ -24,6 +24,12 @@ class ResUsersRole(models.Model): user_ids = fields.One2many( 'res.users', string=u"Users", compute='_compute_user_ids') + _defaults = { # pylint: disable=attribute-deprecated + 'category_id': api.model( + lambda cls: cls.env.ref( + 'base_user_role.ir_module_category_role').id), + } + @api.multi @api.depends('line_ids.user_id') def _compute_user_ids(self):