[IMP] res_user: allow writing on new user_email field by its owner
bzr revid: odo@openerp.com-20100712142205-u709kx2mc2zax1or
This commit is contained in:
parent
96ccd8720c
commit
7247bc820b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue