Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4460 Widoki

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!

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

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

Powiązane posty Odpowiedzi Widoki Czynność
1
lis 22
2608
0
kwi 22
1904
2
wrz 24
3337
3
paź 23
18315
1
paź 22
3636