跳至內容
選單
此問題已被標幟
2 回覆
2009 瀏覽次數

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)

 

頭像
捨棄