From 5b2eaef1ddb2215188b8d8c09d614a8fd4b04e47 Mon Sep 17 00:00:00 2001 From: len Date: Thu, 12 Dec 2024 11:31:12 +0100 Subject: [PATCH 1/4] [FIX] sale_substate: fix inheritance order With the current order, the super to _track_template from the mixin was never called. Which was a good thing since it was also buggy; however the override in this model was removed on the assumption that it was. --- sale_substate/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale_substate/models/sale_order.py b/sale_substate/models/sale_order.py index 66409eb8a48..ea50b9ec331 100644 --- a/sale_substate/models/sale_order.py +++ b/sale_substate/models/sale_order.py @@ -13,5 +13,5 @@ class BaseSubstateType(models.Model): class SaleOrder(models.Model): - _inherit = ["sale.order", "base.substate.mixin"] + _inherit = ["base.substate.mixin", "sale.order"] # order matters!!! _name = "sale.order" From c1bc0df4221a1accebd72cee6ab964194d3bc533 Mon Sep 17 00:00:00 2001 From: len Date: Thu, 12 Dec 2024 15:19:32 +0100 Subject: [PATCH 2/4] [TMP] force temporary test dependency --- test-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test-requirements.txt b/test-requirements.txt index 66bc2cbae3f..0dba0438eaa 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1,2 @@ odoo_test_helper +git+https://github.com/lambdao-dev/server-ux@17.0-fxsbsttmx-len#subdirectory=base_substate # to remove once merged From 5b1e01dbd7a9cd0e670885ea3cbf30ca5a615efc Mon Sep 17 00:00:00 2001 From: len Date: Thu, 12 Dec 2024 15:23:54 +0100 Subject: [PATCH 3/4] [TEST] sale_substate: test mail template --- sale_substate/tests/test_sale_substate.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sale_substate/tests/test_sale_substate.py b/sale_substate/tests/test_sale_substate.py index b363e372569..5a97e506f44 100644 --- a/sale_substate/tests/test_sale_substate.py +++ b/sale_substate/tests/test_sale_substate.py @@ -61,6 +61,15 @@ def test_sale_order_substate(self): self.assertTrue(so_test1.state == "sale") self.assertTrue(so_test1.substate_id == self.substate_valid_docs) + # manually change the substate; this one has a mail template + self.env.cr.flush() # this is to post the messages (it's in after commit hook) + messages = so_test1.message_ids + so_test1.write({"substate_id": self.substate_in_delivery.id}) + self.env.cr.flush() # this is to post the messages (again) + new_messages = so_test1.message_ids - messages + expected_msg = "You order is being prepared for delivery." + self.assertTrue(expected_msg in "".join(new_messages.mapped("body"))) + # Test that substate_id is set to false if # there is not substate corresponding to state so_test1._action_cancel() From a3998e37174cf9c7e713079f17d23ab03bc1979d Mon Sep 17 00:00:00 2001 From: len Date: Thu, 12 Dec 2024 16:30:45 +0100 Subject: [PATCH 4/4] fixup! [FIX] sale_substate: fix inheritance order --- sale_substate/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale_substate/models/sale_order.py b/sale_substate/models/sale_order.py index ea50b9ec331..9954799a870 100644 --- a/sale_substate/models/sale_order.py +++ b/sale_substate/models/sale_order.py @@ -13,5 +13,5 @@ class BaseSubstateType(models.Model): class SaleOrder(models.Model): - _inherit = ["base.substate.mixin", "sale.order"] # order matters!!! + _inherit = ["base.substate.mixin", "sale.order"] # order matters _name = "sale.order"