3

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?

Damien
  • 33
  • 1
  • 4

1 Answers1

2

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).

Majikat
  • 722
  • 4
  • 13
  • That's it! So do you know what doc.payment_term_id.note is about? – Damien Jan 16 '17 at 23:20
  • doc.payment_term_id.note is a text that would explain to the person reading the document what does its payment term induce. The doc.note is just a text that would be used to save something about the document itself. Example in note : this customer is not trustworthy. Example in payment_term_id.note : You will have to pay 50% of the bill right away, and the remainder in 6 months after the bill is emitted. – Majikat Feb 20 '19 at 12:43