From 6337a5968e27e78fd2a407dd01758ff79c75029a Mon Sep 17 00:00:00 2001 From: sebalix Date: Tue, 1 Oct 2019 17:15:58 +0200 Subject: [PATCH] [MIG] base_user_role: Migration to 13.0 --- base_user_role/__manifest__.py | 2 +- base_user_role/data/ir_module_category.xml | 6 ++++++ base_user_role/models/role.py | 7 ------- base_user_role/models/user.py | 3 --- base_user_role/readme/CONTRIBUTORS.rst | 2 +- base_user_role/readme/USAGE.rst | 8 -------- base_user_role/views/role.xml | 1 - 7 files changed, 8 insertions(+), 21 deletions(-) diff --git a/base_user_role/__manifest__.py b/base_user_role/__manifest__.py index 38fd399b7..abdb7dd54 100644 --- a/base_user_role/__manifest__.py +++ b/base_user_role/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'User roles', - 'version': '12.0.1.0.0', + 'version': '13.0.1.0.0', 'category': 'Tools', 'author': 'ABF OSIELL, Odoo Community Association (OCA)', 'license': 'LGPL-3', diff --git a/base_user_role/data/ir_module_category.xml b/base_user_role/data/ir_module_category.xml index 6a10c264a..29ba69fb6 100644 --- a/base_user_role/data/ir_module_category.xml +++ b/base_user_role/data/ir_module_category.xml @@ -4,6 +4,12 @@ --> + User roles diff --git a/base_user_role/models/role.py b/base_user_role/models/role.py index a34f39986..9e0215113 100644 --- a/base_user_role/models/role.py +++ b/base_user_role/models/role.py @@ -32,7 +32,6 @@ class ResUsersRole(models.Model): string="Associated category", help="Associated group's category") - @api.multi @api.depends('line_ids.user_id') def _compute_user_ids(self): for role in self: @@ -44,20 +43,17 @@ class ResUsersRole(models.Model): new_record.update_users() return new_record - @api.multi def write(self, vals): res = super(ResUsersRole, self).write(vals) self.update_users() return res - @api.multi def unlink(self): users = self.mapped('user_ids') res = super(ResUsersRole, self).unlink() users.set_groups_from_roles(force=True) return res - @api.multi def update_users(self): """Update all the users concerned by the roles identified by `ids`.""" users = self.mapped('user_ids') @@ -87,7 +83,6 @@ class ResUsersRoleLine(models.Model): 'res.company', 'Company', default=lambda self: self.env.user.company_id) - @api.multi @api.constrains('user_id', 'company_id') def _check_company(self): for record in self: @@ -98,7 +93,6 @@ class ResUsersRoleLine(models.Model): _('User "{}" does not have access to the company "{}"') .format(record.user_id.name, record.company_id.name)) - @api.multi @api.depends('date_from', 'date_to') def _compute_is_enabled(self): today = datetime.date.today() @@ -113,7 +107,6 @@ class ResUsersRoleLine(models.Model): if today > date_to: role_line.is_enabled = False - @api.multi def unlink(self): users = self.mapped('user_id') res = super(ResUsersRoleLine, self).unlink() diff --git a/base_user_role/models/user.py b/base_user_role/models/user.py index 56b173cc2..23b79e10a 100644 --- a/base_user_role/models/user.py +++ b/base_user_role/models/user.py @@ -31,7 +31,6 @@ class ResUsers(models.Model): }) return default_values - @api.multi @api.depends('role_line_ids.role_id') def _compute_role_ids(self): for user in self: @@ -43,13 +42,11 @@ class ResUsers(models.Model): new_record.set_groups_from_roles() return new_record - @api.multi def write(self, vals): res = super(ResUsers, self).write(vals) self.sudo().set_groups_from_roles() return res - @api.multi def _get_enabled_roles(self): return self.role_line_ids.filtered( lambda rec: rec.is_enabled and diff --git a/base_user_role/readme/CONTRIBUTORS.rst b/base_user_role/readme/CONTRIBUTORS.rst index 4510b4131..ed5062023 100644 --- a/base_user_role/readme/CONTRIBUTORS.rst +++ b/base_user_role/readme/CONTRIBUTORS.rst @@ -1,4 +1,4 @@ -* Sébastien Alix +* Sébastien Alix * Duc, Dao Dong (https://komit-consulting.com) * Jean-Charles Drubay (https://komit-consulting.com) diff --git a/base_user_role/readme/USAGE.rst b/base_user_role/readme/USAGE.rst index 306c2d793..cd31bf738 100644 --- a/base_user_role/readme/USAGE.rst +++ b/base_user_role/readme/USAGE.rst @@ -1,11 +1,3 @@ -[ This file must be present and contains the usage instructions - for end-users. As all other rst files included in the README, - it MUST NOT contain reStructuredText sections - only body text (paragraphs, lists, tables, etc). Should you need - a more elaborate structure to explain the addon, please create a - Sphinx documentation (which may include this file as a "quick start" - section). ] - To use this module, you need to: #. Go to Configuration / Users / Users choose user and set Roles: diff --git a/base_user_role/views/role.xml b/base_user_role/views/role.xml index 2ffa054d8..4cbb8afef 100644 --- a/base_user_role/views/role.xml +++ b/base_user_role/views/role.xml @@ -62,7 +62,6 @@ Roles ir.actions.act_window res.users.role - form