Using ODS and converting to Excel

Hi @pokoli ,

in your reply here that marked as solution, you said

“you can use a ods template with relatorio, and set the extension to xlsx to convert the file to the expected format”

may I know which part of the setting in my code or tryton config to do so?

I am not python programmer (only in this project I started) so I tend to avoid using external libs such as XlsxWriter or any other.

Any advice would be greatly appreciated @pokoli

Regards
Bromo

You need to have libreoffice installed on your server to do the conversion or use an external service like Service to convert document.

If you are using the docker image, you need to use the image suffixed with -office (i.e tryton:7.4-office) which already contains the needed dependencies.

From there its just a mather of setting the xlsxextension on your report definition. Can be done using the user interface or using the xml definition.

1 Like

I already installed libreoffice in the server.. that is why on the other topic, u helped me configure the hyperlink at ODS.

Okay.. so you said, we can setting it at XML.. is it here (below)?

      <!-- Timesheet Spreadsheet Format Definition -->
      <record model="ir.action.report" id="report_user_timesheet_sheet">
         <field name="name">Timesheet-Spreadsheet</field>
         <field name="report_name">afx.user.timesheet.report</field>
         <field name="model">afx.user.timesheet</field>
         <field name="report">afx_timesheet/timesheet.fods</field>
         <field name="template_extension">ods</field>
      </record>
      <record model="ir.action.keyword" id="report_user_timesheet_sheet_keyword">
         <field name="keyword">form_print</field>
         <field name="model">afx.user.timesheet,-1</field>
         <field name="action" ref="report_user_timesheet_sheet"/>
      </record>

Which part? (I am excited)

Bromo

You need to set the extension field of ir.action.report.

Something like:

<record model="ir.action.report" id="report_user_timesheet_sheet">
    <!-- Your current code here -->
    <field name="extension">xlsx</field>
</record>
1 Like