diff --git a/product_state_history/__manifest__.py b/product_state_history/__manifest__.py index 423a25e6a670..9510718ae5dd 100644 --- a/product_state_history/__manifest__.py +++ b/product_state_history/__manifest__.py @@ -5,7 +5,7 @@ "name": "Product State History", "summary": """ Allows to store product state history for reporting purpose""", - "version": "14.0.1.0.2", + "version": "16.0.1.0.0", "license": "AGPL-3", "category": "Sales", "maintainers": ["rousseldenis"], diff --git a/product_state_history/migrations/14.0.1.0.1/pre-migrate.py b/product_state_history/migrations/14.0.1.0.1/pre-migrate.py deleted file mode 100644 index 16f1d9ba9182..000000000000 --- a/product_state_history/migrations/14.0.1.0.1/pre-migrate.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2021 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import logging - -from openupgradelib import openupgrade - -_logger = logging.getLogger(__name__) - - -def _move_history_state_field(env): - field_spec = [ - ( - "product_state_id", - "product.state.history", - "product_state_history", - "many2one", - "integer", - "product_state_history", - ) - ] - openupgrade.add_fields(env, field_spec) - query = """ - UPDATE product_state_history psh - SET product_state_id = - (SELECT id FROM product_state WHERE code = psh.product_state) - """ - env.cr.execute(query) - - -@openupgrade.migrate() -def migrate(env, version): - _move_history_state_field(env) diff --git a/product_state_history/models/product_state_history.py b/product_state_history/models/product_state_history.py index a211cdbdf115..4e82e0c21962 100644 --- a/product_state_history/models/product_state_history.py +++ b/product_state_history/models/product_state_history.py @@ -5,7 +5,6 @@ class ProductStateHistory(models.Model): - _name = "product.state.history" _description = "Product State History" _order = "id desc" diff --git a/product_state_history/models/product_template.py b/product_state_history/models/product_template.py index 2715e3c21b88..5e09d25714d8 100644 --- a/product_state_history/models/product_template.py +++ b/product_state_history/models/product_template.py @@ -36,8 +36,7 @@ def write(self, vals): return res def action_product_state_history(self): - action = self.env.ref("product_state_history.product_state_history_act_window") - result = action.read()[0] - result.update({"domain": [("product_template_id", "in", self.ids)]}) - - return result + xmlid = "product_state_history.product_state_history_act_window" + action = self.env["ir.actions.act_window"]._for_xml_id(xmlid) + action.update({"domain": [("product_template_id", "in", self.ids)]}) + return action diff --git a/product_state_history/models/report_product_state_history.py b/product_state_history/models/report_product_state_history.py index 7225ee973ba9..12b4d915aa86 100644 --- a/product_state_history/models/report_product_state_history.py +++ b/product_state_history/models/report_product_state_history.py @@ -5,7 +5,6 @@ class ReportProductStateHistory(models.AbstractModel): - _name = "report.product_state_history.report_product_state_history" _description = "Product State History Report" diff --git a/product_state_history/tests/common.py b/product_state_history/tests/common.py index 0ec336199374..6d25a3795ddc 100644 --- a/product_state_history/tests/common.py +++ b/product_state_history/tests/common.py @@ -1,9 +1,9 @@ # Copyright 2020 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests.common import SavepointCase +from odoo.tests.common import TransactionCase -class CommonProductStateHistory(SavepointCase): +class CommonProductStateHistory(TransactionCase): @classmethod def setUpClass(cls): super(CommonProductStateHistory, cls).setUpClass() diff --git a/product_state_history/tests/test_product_state_history.py b/product_state_history/tests/test_product_state_history.py index 492d2ca29419..1240cb1a9d08 100644 --- a/product_state_history/tests/test_product_state_history.py +++ b/product_state_history/tests/test_product_state_history.py @@ -1,6 +1,6 @@ # Copyright 2020 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import mock +from unittest import mock from odoo import fields