[12.0][MIG] base_user_role_history - migration from 9.0 to 12.0

This commit is contained in:
Benoit Aimont
2019-10-01 14:41:31 +02:00
committed by Mohamed Osman
parent d85b7da4cc
commit da660af787
8 changed files with 69 additions and 72 deletions

View File

@@ -13,14 +13,14 @@ Base User Role History
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/9.0/base_user_role_history :target: https://github.com/OCA/server-backend/tree/12.0/base_user_role_history
:alt: OCA/server-tools :alt: OCA/server-backend
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-9-0/server-tools-9-0-base_user_role_history :target: https://translation.odoo-community.org/projects/server-backend-12-0/server-backend-12-0-base_user_role_history
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/149/9.0 :target: https://runbot.odoo-community.org/runbot/253/12.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -50,10 +50,10 @@ a role deletion, module could be upgraded.
Bug Tracker Bug Tracker
=========== ===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_user_role_history%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_user_role_history%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@@ -92,6 +92,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-ThomasBinsfeld| |maintainer-ThomasBinsfeld|
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/9.0/base_user_role_history>`_ project on GitHub. This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/12.0/base_user_role_history>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2019 ACSONE SA/NV # Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -6,7 +5,7 @@
'name': 'Base User Role History', 'name': 'Base User Role History',
'summary': """ 'summary': """
This module allows to track the changes on users roles.""", This module allows to track the changes on users roles.""",
'version': '9.0.1.0.0', 'version': '12.0.1.0.0',
'license': 'AGPL-3', 'license': 'AGPL-3',
'author': 'ACSONE SA/NV, ' 'author': 'ACSONE SA/NV, '
'Odoo Community Association (OCA)', 'Odoo Community Association (OCA)',

View File

@@ -4,10 +4,8 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n" "Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-30 11:50+0000\n"
"PO-Revision-Date: 2019-09-30 11:50+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -16,23 +14,23 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.ui.view,arch_db:base_user_role_history.res_users_form_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.res_users_form_view
msgid "<span class=\"o_stat_text\">Last update of roles</span>" msgid "<span class=\"o_stat_text\">Last update of roles</span>"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_performed_action #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__performed_action
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
msgid "Action" msgid "Action"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_is_enabled #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__new_is_enabled
msgid "Active after edit" msgid "Active after edit"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_is_enabled #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__old_is_enabled
msgid "Active before edit" msgid "Active before edit"
msgstr "" msgstr ""
@@ -42,18 +40,18 @@ msgid "Add"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_create_uid #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__create_uid
msgid "Created by" msgid "Created by"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_create_date #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__create_date
msgid "Created on" msgid "Created on"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view
msgid "Date and time of edition" msgid "Date and time of edition"
msgstr "" msgstr ""
@@ -63,7 +61,7 @@ msgid "Delete"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_display_name #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__display_name
msgid "Display Name" msgid "Display Name"
msgstr "" msgstr ""
@@ -73,18 +71,18 @@ msgid "Edit"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
msgid "Edited user" msgid "Edited user"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_form_view
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_tree_view
msgid "Editor" msgid "Editor"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
msgid "Group By" msgid "Group By"
msgstr "" msgstr ""
@@ -94,71 +92,71 @@ msgid "History of user roles"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_id #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__id
msgid "ID" msgid "ID"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history___last_update #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history____last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_write_uid #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__write_uid
msgid "Last Updated by" msgid "Last Updated by"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_write_date #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__write_date
msgid "Last Updated on" msgid "Last Updated on"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_res_users_last_role_line_modification #: model:ir.model.fields,field_description:base_user_role_history.field_res_users__last_role_line_modification
msgid "Last roles modification" msgid "Last roles modification"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_date_to #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__new_date_to
msgid "New end date" msgid "New end date"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_role_id #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__new_role_id
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
msgid "New role" msgid "New role"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_new_date_from #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__new_date_from
msgid "New start date" msgid "New start date"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_date_to #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__old_date_to
msgid "Old end date" msgid "Old end date"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_role_id #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__old_role_id
#: model:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.base_user_role_line_history_search_view
msgid "Old role" msgid "Old role"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_old_date_from #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__old_date_from
msgid "Old start date" msgid "Old start date"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: code:addons/base_user_role_history/models/res_users.py:70 #: code:addons/base_user_role_history/models/res_users.py:70
#: model:ir.ui.view,arch_db:base_user_role_history.res_users_form_view #: model_terms:ir.ui.view,arch_db:base_user_role_history.res_users_form_view
#, python-format #, python-format
msgid "Roles history" msgid "Roles history"
msgstr "" msgstr ""
#. module: base_user_role_history #. module: base_user_role_history
#: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history_user_id #: model:ir.model.fields,field_description:base_user_role_history.field_base_user_role_line_history__user_id
msgid "User" msgid "User"
msgstr "" msgstr ""

View File

@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2019 ACSONE SA/NV # Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, fields, models from odoo import api, fields, models
class BaseUserRoleLineHistory(models.Model): class BaseUserRoleLineHistory(models.Model):

View File

@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2019 ACSONE SA/NV # Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, fields, models, _ from odoo import api, fields, models, _
class ResUsers(models.Model): class ResUsers(models.Model):
@@ -18,8 +17,8 @@ class ResUsers(models.Model):
return { return {
'user_id': role_line.user_id.id, 'user_id': role_line.user_id.id,
'role_id': role_line.role_id.id, 'role_id': role_line.role_id.id,
'date_from': fields.Date.from_string(role_line.date_from), 'date_from': role_line.date_from,
'date_to': fields.Date.from_string(role_line.date_to), 'date_to': role_line.date_to,
'is_enabled': role_line.is_enabled, 'is_enabled': role_line.is_enabled,
} }
@@ -33,9 +32,10 @@ class ResUsers(models.Model):
self._prepare_role_line_history_dict(role_line) self._prepare_role_line_history_dict(role_line)
return role_line_values_by_user return role_line_values_by_user
@api.model @api.model_create_multi
def create(self, vals): def create(self, vals_list):
res = super(ResUsers, self).create(vals) res = super().create(vals_list)
for vals in vals_list:
if 'role_line_ids' not in vals: if 'role_line_ids' not in vals:
return res return res
new_role_line_values_by_user = res._get_role_line_values_by_user() new_role_line_values_by_user = res._get_role_line_values_by_user()
@@ -49,9 +49,9 @@ class ResUsers(models.Model):
@api.multi @api.multi
def write(self, vals): def write(self, vals):
if 'role_line_ids' not in vals: if 'role_line_ids' not in vals:
return super(ResUsers, self).write(vals) return super().write(vals)
old_role_line_values_by_user = self._get_role_line_values_by_user() old_role_line_values_by_user = self._get_role_line_values_by_user()
res = super(ResUsers, self).write(vals) res = super().write(vals)
new_role_line_values_by_user = self._get_role_line_values_by_user() new_role_line_values_by_user = self._get_role_line_values_by_user()
self.env['base.user.role.line.history'].create_from_vals( self.env['base.user.role.line.history'].create_from_vals(
old_role_line_values_by_user, old_role_line_values_by_user,

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/9.0/base_user_role_history"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-9-0/server-tools-9-0-base_user_role_history"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/9.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-backend/tree/12.0/base_user_role_history"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-backend-12-0/server-backend-12-0-base_user_role_history"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/253/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This addon provides history for roles modifications on users. <p>This addon provides history for roles modifications on users.
Each time a role is added/updated/unlinked on a user, a new role history line Each time a role is added/updated/unlinked on a user, a new role history line
is created mentioning what changes were made and who made them. is created mentioning what changes were made and who made them.
@@ -398,10 +398,10 @@ a role deletion, module could be upgraded.</p>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-backend/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_user_role_history%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20base_user_role_history%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -428,7 +428,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p> <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/ThomasBinsfeld"><img alt="ThomasBinsfeld" src="https://github.com/ThomasBinsfeld.png?size=40px" /></a></p> <p><a class="reference external" href="https://github.com/ThomasBinsfeld"><img alt="ThomasBinsfeld" src="https://github.com/ThomasBinsfeld.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/9.0/base_user_role_history">OCA/server-tools</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/12.0/base_user_role_history">OCA/server-backend</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2019 ACSONE SA/NV # Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).µ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).µ
from datetime import date, timedelta from datetime import date, timedelta
from openerp import fields from odoo.tests.common import SavepointCase
from openerp.tests.common import SavepointCase
class TestBaseUserRoleHistory(SavepointCase): class TestBaseUserRoleHistory(SavepointCase):
@@ -83,12 +81,12 @@ class TestBaseUserRoleHistory(SavepointCase):
self.assertEqual(history_lines_2.old_role_id, self.role_01) self.assertEqual(history_lines_2.old_role_id, self.role_01)
self.assertEqual(history_lines_2.new_role_id, self.role_01) self.assertEqual(history_lines_2.new_role_id, self.role_01)
self.assertFalse(history_lines_2.old_date_from) self.assertFalse(history_lines_2.old_date_from)
self.assertEqual(history_lines_2.new_date_from, self.assertEqual(history_lines_2.new_date_from, date.today())
fields.Date.to_string(date.today()))
self.assertFalse(history_lines_2.old_date_to) self.assertFalse(history_lines_2.old_date_to)
self.assertEqual(history_lines_2.new_date_to, self.assertEqual(
fields.Date.to_string( history_lines_2.new_date_to,
date.today() + timedelta(days=5))) date.today() + timedelta(days=5)
)
self.user_01.write({ self.user_01.write({
'role_line_ids': [(1, self.user_01.role_line_ids[0].id, {})] 'role_line_ids': [(1, self.user_01.role_line_ids[0].id, {})]
}) })
@@ -110,12 +108,15 @@ class TestBaseUserRoleHistory(SavepointCase):
self.assertEqual(history_lines_4.performed_action, 'unlink') self.assertEqual(history_lines_4.performed_action, 'unlink')
self.assertEqual(history_lines_4.old_role_id, self.role_01) self.assertEqual(history_lines_4.old_role_id, self.role_01)
self.assertFalse(history_lines_4.new_role_id) self.assertFalse(history_lines_4.new_role_id)
self.assertEqual(history_lines_4.old_date_from, self.assertEqual(
fields.Date.to_string(date.today())) history_lines_4.old_date_from,
date.today()
)
self.assertFalse(history_lines_4.new_date_from) self.assertFalse(history_lines_4.new_date_from)
self.assertEqual(history_lines_4.old_date_to, self.assertEqual(
fields.Date.to_string( history_lines_4.old_date_to,
date.today() + timedelta(days=5))) date.today() + timedelta(days=5)
)
self.assertFalse(history_lines_4.new_date_to) self.assertFalse(history_lines_4.new_date_to)
def test_create_role_lines_on_new_user(self): def test_create_role_lines_on_new_user(self):