Export file using predefined export in a wizard

I have a wizard that when it’s executed it lists records of a ModelView class. It’s looks quite similar to the Bom Tree relate of a product.
And what I want is that when you pass to another transition called “Export”, an xlsx file is generated with the same information that was listed. To do that, I would like to use the predefined export or if it should be done by another way, another.
Thanks beforehand.

You can use the export_data function to get the data related to the export and generate the xlsx file using openpyxl.

If you want to reuse a predefined export, you should load the field names from the ir.export model.

I’m recomending this function because this is the one called by the clients when exporting data.

1 Like

I can’t call export_data function cause I’m not inhereting ModelStorage.

How can I do that?

Finally, I did it using a Binary field and filling it in the wizard in a new StateView.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.