Browse Source

[IMP] base_user_role - Set a default category to associated groups

pull/922/head
sebalix 8 years ago
parent
commit
456df8eab7
  1. 1
      base_user_role/__openerp__.py
  2. 12
      base_user_role/data/ir_module_category.xml
  3. 6
      base_user_role/models/role.py

1
base_user_role/__openerp__.py

@ -15,6 +15,7 @@
], ],
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'data/ir_module_category.xml',
'data/ir_cron.xml', 'data/ir_cron.xml',
'views/role.xml', 'views/role.xml',
'views/user.xml', 'views/user.xml',

12
base_user_role/data/ir_module_category.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<openerp>
<data>
<record model="ir.module.category" id="ir_module_category_role">
<field name='name'>User roles</field>
</record>
</data>
</openerp>

6
base_user_role/models/role.py

@ -24,6 +24,12 @@ class ResUsersRole(models.Model):
user_ids = fields.One2many( user_ids = fields.One2many(
'res.users', string=u"Users", compute='_compute_user_ids') '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.multi
@api.depends('line_ids.user_id') @api.depends('line_ids.user_id')
def _compute_user_ids(self): def _compute_user_ids(self):

Loading…
Cancel
Save