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

Hello, 

I am using Odoo 16.0 SH and I am trying to write the HTML code to dynamically pull in users information into their email signature. 

In the settings app>users>Select a user> Preferences tab> Email signature


Trying to write one string of code that can be used for all users and goes off of their employee data so that if an employees title changes their signature will update automatically. 

This is what I have so far. 



When I leave code view this is what it looks like, but the second I hit save it clears out all of the span tags and t-out information. 



What am I doing wrong? 

Avatar
Discard
Best Answer

Hi,

You can try to use t-esc instead of the t-out 

<p>
  Regards,
  <br/>
<span t-esc="user.name"/>
  <br/>
<span t-esc="user.employee_id.job_title"/>
  <br/>
Phone: <span t-esc="user.partner_id.phone"/>
  <br/>
Email: <a t-attf="mailto:#{user.email}"><span t-esc="user.email"/></a>
</p>


user.name: This will dynamically insert the user's name.

user.employee_id.job_title: This will retrieve the user's job title from their linked employee data.

user.partner_id.phone: This will insert the user's phone number from their partner data (assuming phone number is stored in the partner record).

user.email: This will display the user's email address.

mailto:#{user.email}: This will create a mailto link for the email address.
Make sure you're using these expressions within the appropriate t tags to make them properly evaluated in Odoo's templating system. If you're still encountering issues with the HTML code getting cleared out when you save, it could be due to certain restrictions or validation in the email signature field. If that's the case, you might want to consult Odoo's documentation or support resources for specific guidance on how to achieve dynamic email signatures.

Remember to back up your code before making any significant changes, and test your code in a controlled environment before applying it to your live Odoo instance.


Hope it helps


Avatar
Discard
Related Posts Replies Views Activity
0
Sep 23
908
1
Aug 23
3060
1
Jun 23
1488
1
Mar 25
1934
0
May 24
828