Skip to content

Commit

Permalink
[MIG] base_user_role_history: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed Osman committed Jun 4, 2024
1 parent 5bc1180 commit de485b4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion base_user_role_history/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 6 additions & 10 deletions base_user_role_history/models/base_user_role_line_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 1 addition & 3 deletions base_user_role_history/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
20 changes: 10 additions & 10 deletions base_user_role_history/views/base_user_role_line_history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
<sheet>
<group name="group_main" col="4">
<field name="create_uid" string="Editor" />
<field name="performed_action" />
<field name="user_id" string="Edited user" />
<field name="performed_action" readonly="True" />
<field name="user_id" string="Edited user" readonly="True" />
<field name="create_date" string="Date and time of edition" />
<field name="old_role_id" />
<field name="new_role_id" />
<field name="old_date_from" />
<field name="new_date_from" />
<field name="old_date_to" />
<field name="new_date_to" />
<field name="old_is_enabled" />
<field name="new_is_enabled" />
<field name="old_role_id" readonly="True" />
<field name="new_role_id" readonly="True" />
<field name="old_date_from" readonly="True" />
<field name="new_date_from" readonly="True" />
<field name="old_date_to" readonly="True" />
<field name="new_date_to" readonly="True" />
<field name="old_is_enabled" readonly="True" />
<field name="new_is_enabled" readonly="True" />
</group>
</sheet>
</form>
Expand Down
1 change: 1 addition & 0 deletions base_user_role_history/views/res_users.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<field
class="o_stat_value"
name="last_role_line_modification"
readonly="True"
/>
</div>
</button>
Expand Down

0 comments on commit de485b4

Please sign in to comment.