Skip to Content
Menú
This question has been flagged

Hello community.

I have tried several times, but so far I have not succeeded. In the Profit and Loss report I need to add a button to export in a format other than PDF and/or XLSX, so I need to add a button as indicated in the following image.


I am using the following code but it never triggers anything

# models/report.py
from odoo import models, api
import base64
class CustomAccountReport(models.AbstractModel):
    _inherit = 'account.report'
    def _custom_options_initializer(self, report, options, previous_options=None):
        super()._custom_options_initializer(report, options, previous_options=previous_options)
        codigoPais = self.env.company.account_fiscal_country_id.code;
       options.setdefault('buttons', []).append({            'name': 'export_txt_peru',            'label': 'Exportar TXT (PE)',            'method': 'action_export_txt_peru',            'file_export_type': 'txt',        })

I am already using something similar in the tax report, the difference is the model from which it inherits.


HELP!

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de jul. 22
2363
1
de febr. 16
4252
0
de jul. 25
541
2
de febr. 23
1937
2
de juny 16
5828