diff options
| author | Rémi Rahir <rar@odoo.com> | 2019-09-12 11:04:58 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-09-12 13:21:48 +0000 |
| commit | 3f401e3e2f8ad5d8b2c43ad96b331433b7b8d9a0 (patch) | |
| tree | 51f9c74f84c1319656cf32bbd2eef014d6fc723e | |
| parent | 4895b452c1f3868c8c2f8c9dfa856c5a066f3aa3 (diff) | |
[FIX] snailmail: do not decode null objects
Prior to this commit, we would try to decode the logo of a company
without any verification on its presence. If the logo was not set, we'd
try to decode nothing which caused a crash.
This commit ensure that we asert that the field is set before trying to
encode it for a JSON payload.
closes odoo/odoo#36784
X-original-commit: f40f763831bace8c499072ea81ef9bbd5fc910e4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
| -rw-r--r-- | addons/snailmail/models/snailmail_letter.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/snailmail/models/snailmail_letter.py b/addons/snailmail/models/snailmail_letter.py index b058a6b9ecf..6492442844e 100644 --- a/addons/snailmail/models/snailmail_letter.py +++ b/addons/snailmail/models/snailmail_letter.py @@ -220,7 +220,7 @@ 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.decode('utf-8'), + 'company_logo': letter.company_id.logo_web and letter.company_id.logo_web.decode('utf-8') or False, }) attachment = letter._fetch_attachment() if attachment: |
