跳至内容
菜单
此问题已终结

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!

形象
丢弃
相关帖文 回复 查看 活动
0
7月 22
2383
1
2月 16
4270
0
7月 25
593
2
2月 23
1966
2
6月 16
5868