Browse Source

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

pull/641/head
sebalix 8 years ago
parent
commit
167d999bcf
  1. 1
      base_user_role/__openerp__.py
  2. 10
      base_user_role/data/ir_module_category.xml
  3. 4
      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',

10
base_user_role/data/ir_module_category.xml

@ -0,0 +1,10 @@
<?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). -->
<odoo>
<record model="ir.module.category" id="ir_module_category_role">
<field name='name'>User roles</field>
</record>
</odoo>

4
base_user_role/models/role.py

@ -23,6 +23,10 @@ class ResUsersRole(models.Model):
'res.users.role.line', 'role_id', string=u"Users") 'res.users.role.line', 'role_id', string=u"Users")
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')
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.multi
@api.depends('line_ids.user_id') @api.depends('line_ids.user_id')

Loading…
Cancel
Save