[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.
This commit is contained in:
Martin Trigaux
2016-05-23 15:36:12 +02:00
parent 91acf0ab51
commit 17e144f51b
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -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):
+1 -1
View File
@@ -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']))