From 36518581a0511ffe44128ebf6eec886c5068a5e9 Mon Sep 17 00:00:00 2001 From: Mohamed Osman Date: Tue, 4 Jun 2024 17:43:17 +0000 Subject: [PATCH] [MIG] base_user_role_history: Migration to 17.0 --- base_user_role_history/__manifest__.py | 2 +- .../models/base_user_role_line_history.py | 16 ++++++--------- base_user_role_history/models/res_users.py | 4 +--- .../tests/test_base_user_role_history.py | 2 +- .../views/base_user_role_line_history.xml | 20 +++++++++---------- base_user_role_history/views/res_users.xml | 1 + 6 files changed, 20 insertions(+), 25 deletions(-) diff --git a/base_user_role_history/__manifest__.py b/base_user_role_history/__manifest__.py index 218388d7b..3ef780948 100644 --- a/base_user_role_history/__manifest__.py +++ b/base_user_role_history/__manifest__.py @@ -5,7 +5,7 @@ "name": "Base User Role History", "summary": """ This module allows to track the changes on users roles.""", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "author": "ACSONE SA/NV, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/server-backend", diff --git a/base_user_role_history/models/base_user_role_line_history.py b/base_user_role_history/models/base_user_role_line_history.py index 328fe5bfc..9879e152d 100644 --- a/base_user_role_history/models/base_user_role_line_history.py +++ b/base_user_role_history/models/base_user_role_line_history.py @@ -13,35 +13,31 @@ class BaseUserRoleLineHistory(models.Model): string="Action", selection=[("add", "Add"), ("unlink", "Delete"), ("edit", "Edit")], required=True, - readonly=True, ) user_id = fields.Many2one( string="User", comodel_name="res.users", ondelete="cascade", - readonly=True, index=True, ) old_role_id = fields.Many2one( string="Old role", comodel_name="res.users.role", ondelete="cascade", - readonly=True, index=True, ) new_role_id = fields.Many2one( string="New role", comodel_name="res.users.role", ondelete="cascade", - readonly=True, index=True, ) - old_date_from = fields.Date(string="Old start date", readonly=True) - new_date_from = fields.Date(string="New start date", readonly=True) - old_date_to = fields.Date(string="Old end date", readonly=True) - new_date_to = fields.Date(string="New end date", readonly=True) - old_is_enabled = fields.Boolean(string="Active before edit", readonly=True) - new_is_enabled = fields.Boolean(string="Active after edit", readonly=True) + old_date_from = fields.Date(string="Old start date") + new_date_from = fields.Date(string="New start date") + old_date_to = fields.Date(string="Old end date") + new_date_to = fields.Date(string="New end date") + old_is_enabled = fields.Boolean(string="Active before edit") + new_is_enabled = fields.Boolean(string="Active after edit") @api.model def _prepare_create_from_vals( diff --git a/base_user_role_history/models/res_users.py b/base_user_role_history/models/res_users.py index 2a408287b..b137c8223 100644 --- a/base_user_role_history/models/res_users.py +++ b/base_user_role_history/models/res_users.py @@ -7,9 +7,7 @@ class ResUsers(models.Model): _inherit = "res.users" - last_role_line_modification = fields.Datetime( - string="Last roles modification", readonly=True - ) + last_role_line_modification = fields.Datetime(string="Last roles modification") @api.model def _prepare_role_line_history_dict(self, role_line): diff --git a/base_user_role_history/tests/test_base_user_role_history.py b/base_user_role_history/tests/test_base_user_role_history.py index fa81febf6..d1479acc4 100644 --- a/base_user_role_history/tests/test_base_user_role_history.py +++ b/base_user_role_history/tests/test_base_user_role_history.py @@ -9,7 +9,7 @@ class TestBaseUserRoleHistory(TransactionCase): @classmethod def setUpClass(cls): - super(TestBaseUserRoleHistory, cls).setUpClass() + super().setUpClass() cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) # MODELS diff --git a/base_user_role_history/views/base_user_role_line_history.xml b/base_user_role_history/views/base_user_role_line_history.xml index 8031ba346..2eb1bd9df 100644 --- a/base_user_role_history/views/base_user_role_line_history.xml +++ b/base_user_role_history/views/base_user_role_line_history.xml @@ -15,17 +15,17 @@ - - + + - - - - - - - - + + + + + + + + diff --git a/base_user_role_history/views/res_users.xml b/base_user_role_history/views/res_users.xml index 0f659e06d..b68332d83 100644 --- a/base_user_role_history/views/res_users.xml +++ b/base_user_role_history/views/res_users.xml @@ -21,6 +21,7 @@