[FIX] website: prevent favicon removal to crash

Before this commit, when one would remove the favicon of a website in
the settings it would crash.
This is because since [1] the introduction of `base64.b64encode()` in
the `_handle_favicon()` method make it crash with `False` value.

Steps to reproduce:
- Settings > website
- Delete favicon

[1]: https://github.com/odoo/odoo/commit/6b8752604898bf2b583b7f5334e35f6a1583595e

opw-2958836

closes odoo/odoo#100399

X-original-commit: 35ce152d7e5c50cb363c0fa7adecf174fede9e46
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Walid HANNICHE (waha)
2022-09-17 00:51:59 +02:00
parent b3106ecd10
commit b8aca9dc5b
+1 -1
View File
@@ -267,7 +267,7 @@ class Website(models.Model):
@api.model
def _handle_favicon(self, vals):
if 'favicon' in vals:
if vals.get('favicon'):
vals['favicon'] = base64.b64encode(tools.image_process(base64.b64decode(vals['favicon']), size=(256, 256), crop='center', output_format='ICO'))
@api.model