summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2020-06-12 08:57:28 +0000
committerJeremy Kersten <jke@odoo.com>2020-06-19 15:03:11 +0000
commitaaeb708089a7c5403c5bfa6e758d1fb3266efdff (patch)
tree98ada0b4c4e9f877376526a40272d3bb38c96ed8 /addons
parentadb908fb32bda137a6b2e8b734cdfe0d5f3a4262 (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')
-rw-r--r--addons/website/models/ir_ui_view.py5
-rw-r--r--addons/website/views/website_views.xml2
2 files changed, 4 insertions, 3 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:
diff --git a/addons/website/views/website_views.xml b/addons/website/views/website_views.xml
index a9996029567..970aa309523 100644
--- a/addons/website/views/website_views.xml
+++ b/addons/website/views/website_views.xml
@@ -272,7 +272,7 @@
<field name="page_ids" invisible="1" />
<field name="first_page_id" attrs="{'invisible': [('page_ids', '=', [])]}" />
<field name="visibility" attrs="{'invisible': [('type', '!=', 'qweb')]}" />
- <field name="visibility_password_display" attrs="{'invisible': [('visibility', '!=', 'password')]}" password="True"/>
+ <field name="visibility_password_display" attrs="{'invisible': [('visibility', '!=', 'password')]}" password="True" string="Visibility Password" />
</field>
<sheet position="before">
<header>