콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
2261 화면

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)

 

아바타
취소