Search code examples
odoo

How do I disable the note when sending an email?


Is there a way to disable the creation of a "log note" when I send an email using the send_mail() method of mail.template?

Basically what I'm doing is sending an email to all team members every time a ticket is opened in the helpdesk. the problem is that in the ticket itself, it creates as many log notes for me as there are emails I send.

How can I disable the creation of log notes?

Thanks in advance


Solution

  • I had the same issue which you are facing so my solution :

            mail_id = template_valuess.with_context(
                ctx).send_mail(self.id, force_send=True)
            if mail_id:
                mail_obj = self.env['mail.mail'].sudo().browse(mail_id)
                mail_message_id = mail_obj.mail_message_id
                mail_message_id.res_id = False
    

    It worked for me as i unlinked the res_id.

    Note: If someone has better option, please add as i'm looking for alternative too.