Skip to Content
Menu
This question has been flagged
1 Reply
3372 Views

Hi, I am using Odoo v14 EE. When I try to add a follower to an existing purchase order (PO), the following template arrives:

"Hello, [current user] invited you to follow Purchase Order document: [current PO number]" 


This is fine. The problem is that I cannot find this email template in Settings> Technical> Email> Templates. I have checked all email templates over there and none of them matches with this text.


I need to access the template so that I can edit it to my preference. Please help me find this template. Thanks!

Avatar
Discard
Best Answer

Hello Tushar

This is not email template this is just wizard form view and you can find this view by go to:
Settings  -- > Technical --> User Interface --> Views
then type add followers in search box and you will get form view.

If you want's to change content of message field then you overwrite default_get method of mail.wizard.invite object.

Thanks

Avatar
Discard
Author

Husain, thanks! Can you please guide me on how I can change the default_get method of the mail.wizard.invite object?

Hello Tushar

You can use following code to overwrite default_get method of mail.wizard.invite object.

class InviteExtended(models.TransientModel):

_inherit = 'mail.wizard.invite'

@api.model

def default_get(self, fields):

result = super(Invite, self).default_get(fields)

if self._context.get('mail_invite_follower_channel_only'):

result['send_mail'] = False

if 'message' not in fields:

return result

user_name = self.env.user.display_name

model = result.get('res_model')

res_id = result.get('res_id')

if model and res_id:

document = self.env['ir.model']._get(model).display_name

title = self.env[model].browse(res_id).display_name

msg_fmt = _('%(user_name)s invited you to follow %(document)s document: %(title)s')

else:

msg_fmt = _('%(user_name)s invited you to follow a new document.')

text = msg_fmt % locals()

message = html.DIV(

html.P(_('Hello,')),

html.P(text)

)

result['message'] = etree.tostring(message)

return result

Related Posts Replies Views Activity
1
Nov 22
1382
0
Apr 22
1024
2
Sep 24
1560
3
Oct 23
15111
1
Oct 22
2561