Merge lp:~openerp-dev/openobject-server/6.0-opw-39153-rha into lp:openobject-server/6.0

Proposed by Rifakat Husen (OpenERP)
Status: Rejected
Rejected by: Olivier Dony (Odoo)
Proposed branch: lp:~openerp-dev/openobject-server/6.0-opw-39153-rha
Merge into: lp:openobject-server/6.0
Diff against target: 38 lines (+1/-20)
1 file modified
bin/addons/base/res/res_user.py (+1/-20)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-opw-39153-rha
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Disapprove
Vinay Rana (OpenERP) (community) Approve
nel Pending
Review via email: mp+82115@code.launchpad.net

Description of the change

Hello,

I have changed type of field user_email of res.users from function field to char. While changing user's email from menu User > Preferences > Preferences, email of user related company's partner(address) email was also changed, and vice versa.

Now if we change user email from preferences then it will change related user's email only.

Kindly review it.

Regards,
Rifakat.

To post a comment you must log in.
Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) :
review: Approve
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

This is not correct, and the original bug report is invalid.
The system works as designed in 6.0: the email of the user is in fact stored in the "address" that is linked to the user. Each user has a new address created when it is initially created, in order to store the email and personal info.

A common mistake is to assign a "global" or "company" email for each user! This will cause all users to share the same address and thus the same email! Each user must have their own unique address.

Because we have seen many configuration mistakes in this area we will be changing the behavior in 6.1, but such a change cannot be performed in 6.0 (stable LTS), instead the configuration error should be addressed and user addresses should be corrected.

Thanks,

review: Disapprove

Unmerged revisions

3539. By Rifakat Husen (OpenERP)

[FIX] base: changed field type of user_email from function to char

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/base/res/res_user.py'
2--- bin/addons/base/res/res_user.py 2011-05-09 10:24:54 +0000
3+++ bin/addons/base/res/res_user.py 2011-11-14 10:12:39 +0000
4@@ -175,25 +175,6 @@
5 extended_users = group_obj.read(cr, uid, extended_group_id, ['users'], context=context)['users']
6 return dict(zip(ids, ['extended' if user in extended_users else 'simple' for user in ids]))
7
8- def _email_get(self, cr, uid, ids, name, arg, context=None):
9- # perform this as superuser because the current user is allowed to read users, and that includes
10- # the email, even without any direct read access on the res_partner_address object.
11- return dict([(user.id, user.address_id.email) for user in self.browse(cr, 1, ids)]) # no context to avoid potential security issues as superuser
12-
13- def _email_set(self, cr, uid, ids, name, value, arg, context=None):
14- if not isinstance(ids,list):
15- ids = [ids]
16- address_obj = self.pool.get('res.partner.address')
17- for user in self.browse(cr, uid, ids, context=context):
18- # perform this as superuser because the current user is allowed to write to the user, and that includes
19- # the email even without any direct write access on the res_partner_address object.
20- if user.address_id:
21- address_obj.write(cr, 1, user.address_id.id, {'email': value or None}) # no context to avoid potential security issues as superuser
22- else:
23- address_id = address_obj.create(cr, 1, {'name': user.name, 'email': value or None}) # no context to avoid potential security issues as superuser
24- self.write(cr, uid, ids, {'address_id': address_id}, context)
25- return True
26-
27 def _set_new_password(self, cr, uid, id, name, value, args, context=None):
28 if value is False:
29 # Do not update the password if no value is provided, ignore silently.
30@@ -245,7 +226,7 @@
31 'view': fields.function(_get_interface_type, method=True, type='selection', fnct_inv=_set_interface_type,
32 selection=[('simple','Simplified'),('extended','Extended')],
33 string='Interface', help="Choose between the simplified interface and the extended one"),
34- 'user_email': fields.function(_email_get, method=True, fnct_inv=_email_set, string='Email', type="char", size=240),
35+ 'user_email': fields.char('Email', size=64),
36 'menu_tips': fields.boolean('Menu Tips', help="Check out this box if you want to always display tips on each menu action"),
37 'date': fields.datetime('Last Connection', readonly=True),
38 }