From 17e144f51bc026d9796d911d8440468168c19993 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 23 May 2016 15:07:44 +0200 Subject: [PATCH] [FIX] mail,website_forum: set SELF_WRITABLE_FIELDS on model's class Otherwise it is not visible when set on an instance of the new API. self is a recordset instead of the model `res.users` Without this patch a low priviledge user was not able to modify its own value of `notify_email` through the preference window. --- addons/mail/models/res_users.py | 8 ++++---- addons/website_forum/models/res_users.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/mail/models/res_users.py b/addons/mail/models/res_users.py index d0c16736ef8..ee3ee5f6b1c 100644 --- a/addons/mail/models/res_users.py +++ b/addons/mail/models/res_users.py @@ -27,11 +27,11 @@ class Users(models.Model): """ init_res = super(Users, self).__init__(pool, cr) # duplicate list to avoid modifying the original reference - self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) - self.SELF_WRITEABLE_FIELDS.extend(['notify_email']) + type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) + type(self).SELF_WRITEABLE_FIELDS.extend(['notify_email']) # duplicate list to avoid modifying the original reference - self.SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) - self.SELF_READABLE_FIELDS.extend(['notify_email', 'alias_domain', 'alias_name']) + type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) + type(self).SELF_READABLE_FIELDS.extend(['notify_email', 'alias_domain', 'alias_name']) return init_res def get_alias_model_name(self, vals): diff --git a/addons/website_forum/models/res_users.py b/addons/website_forum/models/res_users.py index 44206d2b27e..3a5d8c92395 100644 --- a/addons/website_forum/models/res_users.py +++ b/addons/website_forum/models/res_users.py @@ -12,7 +12,7 @@ class Users(models.Model): def __init__(self, pool, cr): init_res = super(Users, self).__init__(pool, cr) - self.SELF_WRITEABLE_FIELDS = list( + type(self).SELF_WRITEABLE_FIELDS = list( set( self.SELF_WRITEABLE_FIELDS + ['country_id', 'city', 'website', 'website_description', 'website_published']))