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!