Skip to Content
Menu
This question has been flagged
1 Reply
3111 Views

I would like to allow user(s) to create the content of a report and allow field insertion (as in the mail templates).

for now I have a html field in my module and the content is added to my report. but additions like:

${object.company_id.name} or <span t-field="doc.company_id.name"/>

are added as is. I tried both t-esc and t-raw on the html field.

Is there a way to have the field reference replaced with it's value?

an exemple of what I would like to achieve:

===== HTML rendered content:

Lorem ipsum ${object.project_id.company_id.name}.
dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. 
In enim ${object.module.subject} justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi.

=====

===== Desired Result:

Lorem ipsum Azure Interior.
dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. 
In enim Azure Interior justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi.

=====

Avatar
Discard
Author Best Answer

The documentation was helpfull:
https://www.odoo.com/documentation/12.0/reference/reports.html#custom-reports

1. create a field with the html content
2. create another field calculated that will call your "render_html" function to process the html content.

Avatar
Discard
Related Posts Replies Views Activity
4
Nov 24
5235
1
Mar 24
395
3
Sep 23
22647
0
Feb 24
1718
1
Oct 22
2782