Skip to content

Commit 50c029c

Browse files
committed
Merge PR #4156 into 16.0
Signed-off-by sergiocorato
2 parents ea10794 + 86eefcc commit 50c029c

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

l10n_it_fatturapa_out/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
{
1010
"name": "ITA - Fattura elettronica - Emissione",
11-
"version": "16.0.1.5.1",
11+
"version": "16.0.1.6.0",
1212
"development_status": "Beta",
1313
"category": "Localization/Italy",
1414
"summary": "Emissione fatture elettroniche",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2025 Michele Di Croce - Stesi Consulting
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
@openupgrade.migrate()
8+
def migrate(env, version):
9+
# Clean old transient data
10+
drop_old_wizard_export_sql = "DELETE FROM wizard_export_fatturapa;"
11+
12+
openupgrade.logged_query(env.cr, drop_old_wizard_export_sql)

l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,8 @@ class WizardExportFatturapa(models.TransientModel):
3434
_name = "wizard.export.fatturapa"
3535
_description = "Export E-invoice"
3636

37-
@api.model
38-
def _domain_ir_values(self):
39-
model_name = self.env.context.get("active_model", False)
40-
# Get all print actions for current model
41-
return [
42-
("binding_model_id", "=", model_name),
43-
]
44-
45-
def _get_selection(self):
46-
reports = self.env["ir.actions.report"].sudo().search(self._domain_ir_values())
47-
ret = [(str(r.id), r.name) for r in reports]
48-
return ret
49-
50-
report_print_menu = fields.Selection(
51-
selection="_get_selection",
37+
report_print_menu = fields.Many2one(
38+
"ir.actions.report",
5239
help="This report will be automatically included in the created XML",
5340
)
5441

@@ -318,14 +305,9 @@ def exportFatturaPA(self):
318305
return action
319306

320307
def generate_attach_report(self, inv):
321-
try:
322-
report_id = int(self.report_print_menu)
323-
except ValueError as exc:
324-
raise UserError(_("Print report not found")) from exc
325-
326-
report_model = self.env["ir.actions.report"].sudo().browse(report_id)
308+
report_model = self.env["ir.actions.report"]
327309
attachment, attachment_type = report_model._render_qweb_pdf(
328-
report_model, inv.ids
310+
self.report_print_menu, inv.ids
329311
)
330312
att_id = self.env["ir.attachment"].create(
331313
{

l10n_it_fatturapa_out/wizard/wizard_export_fatturapa_view.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<field
1515
name="report_print_menu"
1616
string="Attached report"
17+
domain="[('binding_model_id','=',context.get('active_model'))]"
1718
widget="selection"
1819
/>
1920
</group>

0 commit comments

Comments
 (0)