diff --git a/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py index d232ee8e0d3e..e1a3518eb960 100644 --- a/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py @@ -32,22 +32,9 @@ class WizardExportFatturapa(models.TransientModel): _name = "wizard.export.fatturapa" _description = "Export E-invoice" - @api.model - def _domain_ir_values(self): - model_name = self.env.context.get("active_model", False) - # Get all print actions for current model - return [ - ("binding_model_id", "=", model_name), - ] - - def _get_selection(self): - reports = self.env["ir.actions.report"].sudo().search(self._domain_ir_values()) - ret = [(str(r.id), r.name) for r in reports] - return ret - - report_print_menu = fields.Selection( - selection="_get_selection", - help="This report will be automatically included in the created XML", + report_print_menu = fields.Many2one( + "ir.actions.report", + help="This report will be automatically included in the created XML" ) def saveAttachment(self, fatturapa, number): @@ -300,14 +287,9 @@ def exportFatturaPA(self): return action def generate_attach_report(self, inv): - try: - report_id = int(self.report_print_menu) - except ValueError as exc: - raise UserError(_("Print report not found")) from exc - - report_model = self.env["ir.actions.report"].sudo().browse(report_id) + report_model = self.env['ir.actions.report'] attachment, attachment_type = report_model._render_qweb_pdf( - report_model, inv.ids + self.report_print_menu, inv.ids ) att_id = self.env["ir.attachment"].create( { diff --git a/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa_view.xml b/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa_view.xml index 491c244844f9..bacc376c3b06 100644 --- a/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa_view.xml +++ b/l10n_it_fatturapa_out/wizard/wizard_export_fatturapa_view.xml @@ -14,6 +14,7 @@