Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3993 Vizualizări

I have a piece of codes to send an email to a user when he did made some choice on the website. The code use the following function to create the email

 http.request.env['mail.mail'].create(mail_values).send()

But it only works when I used admin to login, otherwise, I was given the error:

odoo.exceptions.AccessError: You are not allowed to create 'Outgoing Mails' (mail.mail) records.

This operation is allowed for the following groups:

        - Administration/Settings

I try to find option in settings to grant the permission of sending email to all user. But I cannot find such option. Please help me solve this issue. Thank you very much in advance.

Imagine profil
Abandonează
Autor Cel mai bun răspuns

I find the answer now. I must use sudo to create, i.e. http.request.env['mail.mail'].sudo().create(mail_values).send(), then I can send mails in the method of handling the session of any user.

Imagine profil
Abandonează

this works, thanks

Related Posts Răspunsuri Vizualizări Activitate
0
dec. 24
1390
3
mai 24
1997
1
dec. 23
2314
2
apr. 23
2093
2
dec. 22
8823