[FIX] account_facturx: cleanup attachment management

Since 5cf9d55bbc, 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>
This commit is contained in:
Nans Lefebvre
2019-10-10 14:28:09 +00:00
committed by fw-bot
parent 66a2ca0591
commit 4ef3a14ea3
@@ -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: