PART 1: Export QWeb Reports to PDF in Odoo 17 Community
Step-by-Step to Export QWeb Reports to PDF
Precondition: You need to have the report action and QWeb template properly defined in your custom module.
Step 1: Define QWeb Template
In your custom module:
<template id="report_example_template">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<div class="page">
<h2>Report for <t t-esc="doc.name"/></h2>
<p>Created on: <t t-esc="doc.create_date"/></p>
</div>
</t>
</t>
</template>
Step 2: Define Report Action
<report
id="action_report_example"
model="your.model.name"
string="Example Report"
report_type="qweb-pdf"
name="your_module.report_example_template"
file="your_module.report_example_template"
print_report_name="'Example Report - %s' % (object.name)"
/>
PART 2: Export to Excel and CSV in Odoo 17 Community
Step-by-Step to Export Data to Excel or CSV
Export to CSV (Built-in)
CSV export is available by default:
-
Go to any List View (e.g., Sales Orders, Products).
-
Select one or more records (checkbox).
-
Click Action > Export.
-
Choose fields to export.
-
Choose format: CSV (default).
-
Click Export.
Solution: Use a Free Community Module like export_xlsx
-
Go to https://apps.odoo.com
-
Search for: “Export XLSX” or report_xlsx module.
-
Choose one compatible with Odoo 17 (check version).
-
Install the module in your custom addons directory.
-
Restart Odoo and update the apps list.
-
Now, go to List View > Action > Export, and you'll have the XLSX format option.
Note: Ensure you have Python's xlsxwriter library installed (pip install XlsxWriter), as some modules require it.
Thanks & Regards,
Contact :- DataInteger Consultancy Services LLP