Editing user's email changes all users' emails

Asked by John Bradshaw

Server v6.0.2 with web client.

If we change any users email address it changes for ALL users!
I've put in a brand-new dummy email address (fred@...) and it does replicate. Seems the DB update command is missing a WHERE clause.

Please push this to crtical as it affects data integrity for all users!!

Happy to send screenshots privately.

Checking in psql...
res_users.email is null and the res_partner_address.email is being shown/updated.
The wrong table is being referenced in the code. There is only 1 occurence of the updated email address in the Postgres database (res_partner_address.email)

crm=# select count(*) from res_users;
 count
-------
     7
(1 row)

crm=# select count(*) from res_users where email is null;
 count
-------
     7
(1 row)

crm=# select id, email from res_partner_address where email like '%xxxxxxxx.com';
 id | email
----+-----------------------
  1 | <email address hidden>
(1 row)

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) said :
#1

Let me convert this bug to a question and answer it there, as I think it is starting to become a Frequently Asked Question.

PS: I also corrected the project to 'OpenERP Server', as the definition of Users is part of the core server, and not specific to the web client

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) said :
#2

John,

This typically happens when the "Address" (address_id) field of the users is the same: the "user_email" field is a related field that is directly linked to the email that is set on the address of the user. If you change the email, it will actually change that of the user's address. For this reason, all users should have different, personal address entries.

A common mistake is to try to assign the same address to all users, like a generic "Company address" or similar.
Normally when you create new users or duplicate them, the Address field is either emptied or linked to a fresh, new personal address, which will hold the user's email. If you ever re-assign a different address to the users, be careful to give them all separate addresses, or no address at all. If you don't set an address at all, a new one will be created on-the-fly if you assign an email - which is perfectly fine.

You see the issue if you share the same address with multiple users: they effectively also share the same email!

Now if you install base_contact, the "email" field of the address becomes hidden, so it is less obvious to notice this, but the behavior will be the same (this is actually what bug 720935 is about). So you should always make sure to keep separate addresses for the users, even with base_contact installed.

For 6.1 we will remove the Address of the user, because it is apparently confusing for many users, and make the "user email" a real text field, not a "related field" anymore - much more intuitive.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) said :
#3

Olivier Dony (OpenERP) suggests this article as an answer to your question:
FAQ #1757: “[6.0] Editing user's email changes several/all users' emails”.

Revision history for this message
Ferdinand (office-chricar) said :
#4

@Olivier

IMHO every user must have an address to be able to loacte the user in the company if the company has multiple addresses
see also
https://bugs.launchpad.net/bugs/845476

IMHO if base_contact is not installed the email address must be in res_users, if base_contact is installed all users have to be created as contacts of the company and the email AND other "personal" info like tel no etc can be taken from there

Revision history for this message
John Bradshaw (john-johnbradshaw) said :
#5

Olivier,
Thanks for the explanation.

I find the requirement to have a different address for each user just to get different email addresses for each user very strange. This goes against what I've been taught about databases for a start.

As Ferdinand pointed out it may not work for situations where there are multiple addresses/sites for the company. Our company has 2 sites - group headquarters and our production facility - we will have OpenERP users at both sites soon).

We saw the problem before installing base_contact and it was still present after we installed that module (per the suggestion in a bug report), that really confused our administrator but I can cope with that.

Revision history for this message
Launchpad Janitor (janitor) said :
#6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
John Bradshaw (john-johnbradshaw) said :
#7

Didn't get a satisfactory answer yet, having to add multiple addresses
(one per use) isn't an option for us at the moment.

Revision history for this message
John Bradshaw (john-johnbradshaw) said :
#8

User reports this, I'll have to check this in 6.0.3...

Not sure if this is still happening, but - when scheduling or recording a meeting, the default ‘Organiser’ was coming up as name of last user added and NOT the person who organised it.

If so, is this related to the problem above (latest user added/edited becomes default). That's definitely not correct, user should be the default organiser.

Revision history for this message
John Bradshaw (john-johnbradshaw) said :
#9

Confirmed isue in 6.0.3

When adding a meeting as a normal user my name appears in both the responsible and organizer boxes, however the email shown in the organiser box is that of the last user added. So this problem is being seen in more than one place :-(

Hopefully the 6.1 change will sort this.

Revision history for this message
Launchpad Janitor (janitor) said :
#10

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
John Bradshaw (john-johnbradshaw) said :
#11

Didn't get a satisfactory answer yet, having to add multiple addresses
(one per use) isn't an option for us at the moment.

Revision history for this message
Numérigraphe (numerigraphe) said :
#12

Reopening this again and again is getting annoying.
To me the answer you got seems very satisfactory: for the moment openerp doesn't work like you want it to.
The good thing is you are free to change it in v6, and it has changed in the trunk already so just test it.
Let's move on.
Lionel Sausin.

Revision history for this message
John Bradshaw (john-johnbradshaw) said :
#13

Lionel,
I appreciate your input and agree it's annoying to have to reopen a question however the answer is not good enough at present...

I'm not in a position to roll out a trunk version to a production site nor am I convinced that the changes in trunk/6.1 will fix all these problems... please see my notes from 2011-10-06 about the issue being more wide-spread than first though.

I would like someone to check those queries, so I have confidence in the 6.1 proposal.

Perhaps I'll get a better response from OpenERP SA when we get our OPW for 6.0.3 shortly, but for now questions (or bugs converted to questions) remains my only option.

Can you help with this problem?

Provide an answer of your own, or ask John Bradshaw for more information if necessary.

To post a message you must log in.