3
votes

I would like to be able to print quotations's payment terms in HTML in Odoo.

I edited the sale.order.form view, adding the widget="html" attribut to the term element like this:

<field name="note" widget="html" placeholder="Setup default terms and conditions in your company settings."/>

Now I can use the HTML editor when a create or edit a quote.

Then I edited the quotation report to render that HTML, using t-raw:

<p t-if="doc.payment_term_id.note">
    <span t-raw="doc.payment_term_id.note"/>
 </p>

But it doesn't work. When I print my quotation, the HTML generated from the HTML widget is escape and It prints the HTML elements like

or in the terms.

Did I use t-raw in a bad way?

1

1 Answers

2
votes

t-raw works as you expect. You did not edit the right field in your sale.order.form (or you changed the wrong line in your template).

Doing <field name="note" widget="html" placeholder="Setup default terms and conditions in your company settings."/> then changing the Qweb template to <p t-raw="doc.note"/> produces the expected change.

In your template you are changing another field (doc.payment_term_id.note which is not the same as doc.note).