Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
2236 Ansichten

I'm trying to print some values in the body HTML of an email template based on the values in the environment context object (ctx object). Unfortunately, non of the syntaxes mentioned in the forum or in the Jinja documentation itself is not working, and I get the "Email template does not fit the required schema !" error in the log. 

I'll be grateful for any clue or solution to this problem.

Avatar
Verwerfen
Autor Beste Antwort

Thanks a lot, Waleed Ali Mohen. It's totally worked. I'm afraid it's impossible to choose your answer as the best answer or make a positive vote, as I don't have enough Karma on my profile.


Avatar
Verwerfen
Beste Antwort

Hi,

You can use for loop for enumerate variable as below:

The blow code loop the event attendees.

Attendees


% for attendee in object.event_id.attendee_ids:

style="display: inline-block; border-radius: 50%; width: 10px; height: 10px; background:${colors[attendee.state] or 'white'};">
% if attendee.common_name != object.common_name:
style="margin-left:5px">${attendee.common_name}
% else:
style="margin-left:5px">You
% endif

% endfor
 

Another example from Odoo code using ctx. (Check line 91 and 112)

 

Avatar
Verwerfen