Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
2252 Представления

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.

Аватар
Отменить
Автор Лучший ответ

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.


Аватар
Отменить
Лучший ответ

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)

 

Аватар
Отменить