This question has been flagged
1 Reply
5484 Views

When Internal Notes are sent to users, they see the Note text but until they click VIEW TASK, they won't know to which Project and Customer the Task pertains.

How can I add this information to the Emails they receive?

Avatar
Discard
Best Answer

Yes.

Every Internal Note that "mentions" others (see https://www.odoo.com/documentation/user/12.0/discuss/mentions.html) results in an email sent to each one. The email includes a link to get them back to the Document in Odoo from which the Internal Note was sent.  It may be that you want to give them more information to help them decide how quickly they need to get back into Odoo.

If you'd like to include additional context from the Document, you can intercept the creation of the related Outgoing Mail record (mail.mail) and inject additional information.

 

An Internal Note like this:


Could send an Email with much more information, like this:



Example:



# if the email is related to a Project Task and is an Internal Note
if record.model == 'project.task' and record.message_type == 'comment':
# try to find the related Project Task record
  task = env['project.task'].search([('id','=',record.res_id)])

  if task:
    new_body = ""

    if task.partner_id:
      new_body = new_body + "Customer: " + task.partner_id.name + "<br/>"

    if task.project_id:
      new_body = new_body + "Project: " + task.project_id.name + "<br/>"

    if task.date_deadline:
      new_body = new_body + "Deadline: " + task.date_deadline + "<br/>"

new_body = new_body + "<br/>"

    record['body_html'] = record.body_html.replace("</table>","</table></div><div>" + new_body)



Avatar
Discard