From 4ef3a14ea35d7e63f5140d3b8772d2f8cd84d96b Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Tue, 8 Oct 2019 14:14:24 +0000 Subject: [PATCH] [FIX] account_facturx: cleanup attachment management Since 5cf9d55bbce, attachments are always records. Before, they could also be named tuples, so helpers were needed. Since they are now useless, we can remove them to clean up things. closes odoo/odoo#38414 X-original-commit: 63a937a954c310af88cec214d683f61c64263407 Signed-off-by: Nans Lefebvre (len) --- addons/account_facturx/models/account_move.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/addons/account_facturx/models/account_move.py b/addons/account_facturx/models/account_move.py index 1808bc6d62e..7f509b42b69 100644 --- a/addons/account_facturx/models/account_move.py +++ b/addons/account_facturx/models/account_move.py @@ -247,14 +247,7 @@ class AccountMove(models.Model): move._create_invoice_from_xml(attachment) def _create_invoice_from_pdf(self, attachment): - def _get_attachment_filename(attachment): - # Handle both _Attachment namedtuple in mail.thread or ir.attachment. - return hasattr(attachment, 'fname') and getattr(attachment, 'fname') or attachment.name - - def _get_attachment_content(attachment): - # Handle both _Attachment namedtuple in mail.thread or ir.attachment. - return hasattr(attachment, 'content') and getattr(attachment, 'content') or base64.b64decode(attachment.datas) - content = _get_attachment_content(attachment) + content = base64.b64decode(attachment.datas) with io.BytesIO(content) as buffer: try: