Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] sale_substate: fix inheritance order #3483

Open
wants to merge 4 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sale_substate/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
9 changes: 9 additions & 0 deletions sale_substate/tests/test_sale_substate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Loading