From e373d416d568e3ef3ac53352a67cb77c9fc41ddc Mon Sep 17 00:00:00 2001 From: Eduardo De Miguel Date: Wed, 14 Dec 2022 11:32:59 +0100 Subject: [PATCH] [FIX] mail_notification_custom_subject: Use same approach as Odoo when selecting subtype_id --- mail_notification_custom_subject/models/mail_thread.py | 5 ++++- mail_notification_custom_subject/readme/CONTRIBUTORS.rst | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mail_notification_custom_subject/models/mail_thread.py b/mail_notification_custom_subject/models/mail_thread.py index bc9c33b..8b97a63 100644 --- a/mail_notification_custom_subject/models/mail_thread.py +++ b/mail_notification_custom_subject/models/mail_thread.py @@ -1,5 +1,6 @@ # Copyright 2020-2021 Tecnativa - João Marques # Copyright 2021 Tecnativa - Pedro M. Baeza +# Copyright 2022 Moduon - Eduardo de Miguel # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, models @@ -27,11 +28,13 @@ class MailThread(models.AbstractModel): record_name=False, **kwargs ): - if not subtype_id and subtype_xmlid: + if subtype_xmlid: subtype_id = self.env["ir.model.data"]._xmlid_to_res_id( subtype_xmlid, raise_if_not_found=False, ) + if not subtype_id: + subtype_id = self.env["ir.model.data"]._xmlid_to_res_id("mail.mt_note") if subtype_id: custom_subjects = ( self.env["mail.message.custom.subject"] diff --git a/mail_notification_custom_subject/readme/CONTRIBUTORS.rst b/mail_notification_custom_subject/readme/CONTRIBUTORS.rst index 82fac20..f88a42e 100644 --- a/mail_notification_custom_subject/readme/CONTRIBUTORS.rst +++ b/mail_notification_custom_subject/readme/CONTRIBUTORS.rst @@ -7,3 +7,6 @@ * Versada * Naglis Jonaitis + +* Moduon + * Eduardo de Miguel