Skip to Content
Menu
This question has been flagged
2 Replies
1904 Views

Hello all,

I am trying to create a customer invoice report from Odoo Studio. After generating the report, the product image is not visible in the pdf. 
In the odoo studio, I cannot view the invoice lines option from which I can select the image option.

Please help me with this. If anyone has worked with odoo 17 studio, guide me on how to create customer invoice reports with images.

Thank you.

Avatar
Discard
Best Answer

Hi,

In Odoo 17, there isn't a native option to include an image field and display images in reports like other fields. However, you can manually add an image using the 'Edit Sources' feature and customize the code with:

xml

<span t-field="line.product_id.image_128" t-options-widget="image" t-options-width="64px"/>

For more detailed instructions, you can refer to the documentation:

https://www.odoo.com/documentation/17.0/applications/productivity/studio/pdf_reports.html#editing-the-report-s-xml" target="_blank">Odoo 17 Documentation - Editing the Report's XML


Hope its helps


Avatar
Discard
Best Answer

Hi,

According to the documentation this should work, however I get an error.

I try to achieve something simular, but then in de picking list report. Below the code I've tried

<tr t-foreach="o.move_line_ids_without_package.sorted(lambda ml: ml.product_id.display_name)" t-as="ml">
​<td>
​<span t-field="line.product_id.image_128" t-options-widget="image" t-options-width="64px"/>
​<span t-field="ml.product_id.display_name">Customizable Desk</span><br/>
​<span t-if="ml.product_id.description_picking" t-field="ml.product_id.description_picking">Description on transfer</span>
​</td>


And the error in return:

RPC_ERROR
Arbitrary Uncaught Python Exception
400
Bad Request
                                Session expired (invalid CSRF token)
The above server error caused the following client error:
RPC_ERROR: Arbitrary Uncaught Python Exception
    RPC_ERROR
        at makeErrorFromResponse (link) 
        at decoder.onload (link)


What am I doing wrong?

PS. Instead of line.product_id.image.. I have also tried ml.product_id.image..

Thanks!


Avatar
Discard