I am trying to add a custom report in xlsx format (for excel) and I want it to be accessible from the print button on my purchase orders. I understand that in other versions it is possible, but many of these ways to do it have changed in Odoo 17, does anyone know how to do it in Odoo 17? I thought about this solution but it is not the right one, it does not work.
<odoo>
<record id="action_report_purchase_order_es" model="ir.actions.report">
<field name="name">Orden de compra Español</field>
<field name="model">purchase.order</field>
<field name="report_type">xlsx</field>
<field name="report_name">module_name.purchase_order_report</field>
<field name="binding_model_id" ref="purchase.model_purchase_order" />
<field name="binding_type">report</field>
</record>
</odoo>
In default Odoo, generating an XLSX report from the "Print" button isn't supported. However, you can enable this functionality by installing the OCA module, report_xlsx
. After installing this module, you can define an XLSX report action as follows:
<record id="action_report_partner_xlsx" model="ir.actions.report">
<field name="name">Print to XLSX</field>
<field name="model">res.partner</field>
<field name="report_type">xlsx</field>
<field name="report_name">module_name.report_name</field>
<field name="report_file">module_name.report_file</field>
<field name="binding_model_id" ref="res.partner"/>
<field name="binding_type">report</field>
<field name="attachment_use" eval="False"/>
</record>
Search for the report_xlsx
module in odoo apps store and you will also find the documentation to use it.