summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNans Lefebvre <len@odoo.com>2019-10-08 14:14:24 +0000
committerfw-bot <otis@odoo.com>2019-10-10 14:28:09 +0000
commit4ef3a14ea35d7e63f5140d3b8772d2f8cd84d96b (patch)
treeab4936d3860fd12b586c2559ef3fa10741ea53dc
parent66a2ca059193272215519459e6660c39ec28e2be (diff)
[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) <len@odoo.com>
-rw-r--r--addons/account_facturx/models/account_move.py9
1 files changed, 1 insertions, 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: