Skip to content

Commit

Permalink
[FIX] test script
Browse files Browse the repository at this point in the history
  • Loading branch information
Saran440 committed Jan 26, 2024
1 parent e3863e4 commit 8fc2c69
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 27 deletions.
1 change: 0 additions & 1 deletion base_substate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from . import base_substate
from . import base_substate_mixin
from . import mail_thread
18 changes: 18 additions & 0 deletions base_substate/models/base_substate_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

class BaseSubstateMixin(models.AbstractModel):
_name = "base.substate.mixin"
_inherit = "mail.thread"
_description = "BaseSubstate Mixin"
_state_field = "state"

Expand All @@ -28,6 +29,23 @@ def check_substate_id_value(self):
}
)

def _track_template(self, changes):
res = super()._track_template(changes)
first_rec = self[0]
if "substate_id" in changes and first_rec.substate_id.mail_template_id:
res["substate_id"] = (
first_rec.substate_id.mail_template_id,
{
"composition_mode": "comment",
"auto_delete_message": True,
"subtype_id": self.env["ir.model.data"]._xmlid_to_res_id(
"mail.mt_note"
),
"email_layout_xmlid": "mail.mail_notification_light",
},
)
return res

def _get_default_substate_id(self, state_val=False):
"""Gives default substate_id"""
search_domain = self._get_default_substate_domain(state_val)
Expand Down
25 changes: 0 additions & 25 deletions base_substate/models/mail_thread.py

This file was deleted.

2 changes: 1 addition & 1 deletion base_substate/tests/sale_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class SaleTest(models.Model, TestMixin):
_name = "base.substate.test.sale"
_inherit = ["mail.thread", "base.substate.mixin"]
_inherit = ["base.substate.mixin"]
_description = "Base substate Test Model"

name = fields.Char(required=True)
Expand Down

0 comments on commit 8fc2c69

Please sign in to comment.