From 7247bc820b1d4ce5d83f95299aaebcb2736b7fae Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 12 Jul 2010 16:22:05 +0200 Subject: [PATCH] [IMP] res_user: allow writing on new user_email field by its owner bzr revid: odo@openerp.com-20100712142205-u709kx2mc2zax1or --- bin/addons/base/res/res_user.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index f4f75dd163a..c0d04fe30ca 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -354,15 +354,19 @@ class users(osv.osv): def company_get(self, cr, uid, uid2, context=None): return self._get_company(cr, uid, context=context, uid2=uid2) + # User can write to a few of her own fields (but not her groups for example) + SELF_WRITEABLE_FIELDS = ['view', 'password', 'signature', 'action_id', 'company_id', 'user_email'] + def write(self, cr, uid, ids, values, context=None): if not hasattr(ids, '__iter__'): ids = [ids] if ids == [uid]: for key in values.keys(): - if not (key in ('view', 'password','signature','action_id', 'company_id') or key.startswith('context_')): + if not (key in self.SELF_WRITEABLE_FIELDS or key.startswith('context_')): break else: - uid = 1 + uid = 1 # safe fields only, so we write as super-user + res = super(users, self).write(cr, uid, ids, values, context=context) # clear caches linked to the users