From 62221bc3f95eba63681504283dff2d57b07ed290 Mon Sep 17 00:00:00 2001 From: Antoine Prieels Date: Thu, 3 Jan 2019 09:21:36 +0000 Subject: [PATCH] [FIX] snailmail: Object of type `bytes` is not JSON serializable Sending a letter resulted systematically in an error due to the insertion of the binary of the PDF in the JSON sent to IAP-services. closes odoo/odoo#29880 --- addons/snailmail/models/snailmail_letter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/snailmail/models/snailmail_letter.py b/addons/snailmail/models/snailmail_letter.py index 68505f928ec..b87565123cf 100644 --- a/addons/snailmail/models/snailmail_letter.py +++ b/addons/snailmail/models/snailmail_letter.py @@ -165,12 +165,12 @@ class SnailmailLetter(models.Model): else: # adding the web logo from the company for future possible customization document.update({ - 'company_logo': letter.company_id.logo_web, + 'company_logo': letter.company_id.logo_web.decode('utf-8'), }) attachment = letter._fetch_attachment() if attachment: document.update({ - 'pdf_bin': route == 'print' and attachment.datas, + 'pdf_bin': route == 'print' and attachment.datas.decode('utf-8'), 'pages': route == 'estimate' and self._count_pages_pdf(base64.b64decode(attachment.datas)), }) else: