diff options
| author | Jeremy Kersten <jke@odoo.com> | 2020-06-12 08:57:28 +0000 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2020-06-19 15:03:11 +0000 |
| commit | aaeb708089a7c5403c5bfa6e758d1fb3266efdff (patch) | |
| tree | 98ada0b4c4e9f877376526a40272d3bb38c96ed8 /addons/website/models/ir_ui_view.py | |
| parent | adb908fb32bda137a6b2e8b734cdfe0d5f3a4262 (diff) | |
[FIX] website: create ir.ui.view, don't crypt Falsy password
When you create an ir_ui_view form the backend, the encrypt function
was called with a Falsy value and crash with error:
TypeError: secret must be unicode or bytes, not bool
Now, when you create view from backend, we only set password if it is a qweb
view. In case of update, the field is dirty, so if you don't update it, it
will be not write.
closes odoo/odoo#53348
X-original-commit: 3d9101db0f7cc0adc1f34721c38b4c2f7089566d
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website/models/ir_ui_view.py')
| -rw-r--r-- | addons/website/models/ir_ui_view.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py index a24e8f584f6..d65f3ca11b5 100644 --- a/addons/website/models/ir_ui_view.py +++ b/addons/website/models/ir_ui_view.py @@ -39,8 +39,9 @@ class View(models.Model): def _set_pwd(self): crypt_context = self.env.user._crypt_context() for r in self: - r.sudo().visibility_password = crypt_context.encrypt(r.visibility_password_display) - r.visibility = r.visibility # double check access + if r.type == 'qweb': + r.sudo().visibility_password = r.visibility_password_display and crypt_context.encrypt(r.visibility_password_display) or '' + r.visibility = r.visibility # double check access def _compute_first_page_id(self): for view in self: |
