Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
172 Zobrazení

When i clique a button to open an html report, i'm getting this html pure instead of printing the report : 

<div class="o_stock_card_reports_page"> <div class="button_row"> <button class="o_stock_card_reports_print btn btn-sm oe_button"><span class="fa fa-print"></span>Print</button> <button class="o_stock_card_reports_export btn btn-sm oe_button"><span class="fa fa-download"></span>Export</button> </div> <div class="page"> <div class="row"> <h4 class="mt0" style="text-align: center;">Stock Card - test</h4> </div> <div class="act_as_table data_table" style="width: 100%;"> <div class="act_as_row labels"> <div class="act_as_cell">Date From</div> <div class="act_as_cell">Date To</div> <div class="act_as_cell">Location</div> </div> <div class="act_as_row"> <div class="act_as_cell"> </div> <div class="act_as_cell"> <span>10/08/2025</span> </div> <div class="act_as_cell"> <span>Virtual Locations</span> </div> </div> </div> <div class="act_as_table data_table mt4" style="width: 100%;"> <div class="act_as_thead"> <div class="act_as_row labels"> <div class="act_as_cell">Date</div> <div class="act_as_cell">Reference</div> <div class="act_as_cell">In</div> <div class="act_as_cell">Out</div> <div class="act_as_cell">Balance</div> </div> </div> <div class="act_as_row lines"> <div class="act_as_cell"></div> <div class="act_as_cell"> Initial </div> <div class="act_as_cell"></div> <div class="act_as_cell"></div> <div class="act_as_cell right"> 0.000 </div> </div> </div> <p style="page-break-before:always;"></p> </div> </div>

Avatar
Zrušit
Nejlepší odpověď

Hi,


Your button is just returning the raw HTML string in the HTTP response, so the browser displays it as plain HTML text rather than processing it through Odoo’s reporting engine.


In Odoo, if you want to print a QWeb HTML report or a PDF, you must return an ir.actions.report action, not raw HTML.


Refer to the following for creating the PDF report.


https://www.cybrosys.com/blog/how-to-create-a-pdf-report-in-odoo-18


https://www.cybrosys.com/blog/how-to-add-a-pdf-report-download-button-to-the-odoo-18-customer-portal


https://www.youtube.com/watch?v=zbv4n1I24A4


Hope it helps

Avatar
Zrušit