From 12c0e4d498ab3fe04e455dbe55f24fe85e846ca7 Mon Sep 17 00:00:00 2001 From: FrankC013 Date: Wed, 25 Sep 2024 10:52:08 +0200 Subject: [PATCH] [FIX] account_facturae_attach_existing_attachment: adapt the attachment extensions to the formats allowed for Facturae 3.2 --- .../__init__.py | 1 - .../models/account_move.py | 16 ++++++++++------ .../reports/__init__.py | 1 - .../reports/report_facturae.py | 13 ------------- 4 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 account_facturae_attach_existing_attachment/reports/__init__.py delete mode 100644 account_facturae_attach_existing_attachment/reports/report_facturae.py diff --git a/account_facturae_attach_existing_attachment/__init__.py b/account_facturae_attach_existing_attachment/__init__.py index 55ec7fc9a..0650744f6 100644 --- a/account_facturae_attach_existing_attachment/__init__.py +++ b/account_facturae_attach_existing_attachment/__init__.py @@ -1,2 +1 @@ from . import models -from . import reports diff --git a/account_facturae_attach_existing_attachment/models/account_move.py b/account_facturae_attach_existing_attachment/models/account_move.py index d0570304f..cbe8832a4 100644 --- a/account_facturae_attach_existing_attachment/models/account_move.py +++ b/account_facturae_attach_existing_attachment/models/account_move.py @@ -14,6 +14,11 @@ class AccountMove(models.Model): def _map_format_type_signed_facturaevx(self): return { "xlsx": "xls", + "docx": "doc", + "jpeg": "jpg", + "jfif": "jpg", + "png": "jpg", + "tif": "tiff", } def get_format_types_facturaevx(self): @@ -58,12 +63,11 @@ def _get_facturae_move_attachments(self): description = attachment.name content_type = attachment.type - if self.env.context.get("facturae_signed", False): - content_type = self._map_format_type_signed_facturaevx().get( - content_type, content_type - ) - if content_type not in self.get_format_types_facturaevx(): - continue + content_type = self._map_format_type_signed_facturaevx().get( + content_type, content_type + ) + if content_type not in self.get_format_types_facturaevx(): + continue result.append( { diff --git a/account_facturae_attach_existing_attachment/reports/__init__.py b/account_facturae_attach_existing_attachment/reports/__init__.py deleted file mode 100644 index 39f970114..000000000 --- a/account_facturae_attach_existing_attachment/reports/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import report_facturae diff --git a/account_facturae_attach_existing_attachment/reports/report_facturae.py b/account_facturae_attach_existing_attachment/reports/report_facturae.py deleted file mode 100644 index 903ee87a7..000000000 --- a/account_facturae_attach_existing_attachment/reports/report_facturae.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright NuoBiT Solutions - Frank Cespedes -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) - -from odoo import api, models - - -class ReportFacturae(models.AbstractModel): - _inherit = "report.l10n_es_facturae.facturae_signed" - - @api.model - def generate_report(self, ir_report, docids, data=None): - ir_report = ir_report.with_context(facturae_signed=True) - return super(ReportFacturae, self).generate_report(ir_report, docids, data)