Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odoo 10 - Get current user for use in mail template

Tags:

odoo

odoo-10

A common definition for email template is to use:

${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}

I am trying to use the email from the logged user, not from the object's user:

${(self.env.user.email and '%s <%s>' % (self.env.user.name, self.env.user.email) or '')|safe}

What is wrong in self.env.user.email?

like image 810
M.E. Avatar asked Dec 02 '25 20:12

M.E.


1 Answers

You can try as following :

${(user.email and '%s <%s>' % (user.name, user.email) or '')|safe}
like image 146
Emipro Technologies Pvt. Ltd. Avatar answered Dec 05 '25 13:12

Emipro Technologies Pvt. Ltd.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!