Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
8 Trả lời
6241 Lượt xem

How can I put the code view in email templates in odoo 13?

I can't find the way

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Activate developer mode, and you will see the <> button. 

Click on it and you will get the code editor.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

What I need is to be able to edit an email template with html code.

Currently if I write %if %endif in the email template, "%if %endif" is displayed.

How can I make odoo detect that it is code and not text in odoo 13?

Ảnh đại diện
Huỷ bỏ

by default email template support jinja2 syntax. would you please share your template

Tác giả

For example:

Hola ${object.contact_name}:

Gracias por contactarnos.

%if (${object.x_fechas}):

¿Tiene fechas fijas para el viaje o puede ser flexible? ¿Cuánto tiempo desea estar en la isla?

%endif

With this example the code interprets $ {object.contact_name} and writes that variable.

But "% if" does not interpret it and writes the code.

% if object.x_fechas:

¿Tiene fechas fijas para el viaje o puede ser flexible? ¿Cuánto tiempo desea estar en la isla?

% endif

========

Can you try above code

Tác giả

The code writes:

% if object.x_fechas:

¿Tiene fechas fijas para el viaje o puede ser flexible? ¿Cuánto tiempo desea estar en la isla?

% endif

I don't understand why you don't execute the code. Just write it

Câu trả lời hay nhất

There is no way to display the code view (I mean display color syntax according to language).

There is two alternative option to achieve it.
1) take a screenshot of code (image) and display it as an image(tag) in email template
2) use <pre> tag of HTML, Browsers normally render <pre> text in a fixed-pitched font, with whitespace intact, and without word wrap.

Ảnh đại diện
Huỷ bỏ
Tác giả

What I need is to be able to edit an email template with html code.

Currently if I write %if %endif in the email template, "%if %endif" is displayed.

How can I make odoo detect that it is code and not text in odoo 13?