Kishiro
Kishiro

Reputation: 141

How to get the path of Qweb report in Odoo 11?

I'm on a Qweb Report, I have done :

<div style="background:url('unknown_path') ...>

And I want to set the path of an image stored on my server. So I need to know here I am, to set a relative path.

My report is written in /usr/lib/python3/dist-packages/odoo/addons_adquat/adquat_distribinox_report/report_view.xml but I don't know if the path in the background:url will be from there.

Is it a way to output the path in the report, or to put a breakpoint ? In Qweb I tried <t t-debug />, <t t-debug=""> and <t t-debug="debug"> but it doesn't work.

Other question : can I set an absolute path on the server (like /home/user/myimage.jpg) or it has to be in the odoo directory ?

Upvotes: 0

Views: 467

Answers (1)

Adan Cortes
Adan Cortes

Reputation: 1068

All Odoo paths are relative to the addons directory where your module lives. From your question I infer that your module is called adquat_distribinox_report so, following the Odoo Guidelines (https://www.odoo.com/documentation/12.0/reference/guidelines.html#module-structure), you should put your background file in

/usr/lib/python3/dist-packages/odoo/addons_adquat/adquat_distribinox_report/static/img/background.png

and call it using:

<div style="background-image:url('/adquat_distribinox_report/static/img/background.png') ...>

Upvotes: 0

Related Questions