diff --git a/sale_substate/models/sale_order.py b/sale_substate/models/sale_order.py index 66409eb8a48..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 = ["sale.order", "base.substate.mixin"] + _inherit = ["base.substate.mixin", "sale.order"] # order matters _name = "sale.order" 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() 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