Odoo Help


How to resolve "Integrity Error" on change.password.user when deleting a user after changing his/her password?

Keng Onn
on 8/5/15, 9:41 AM 2,272 views

The steps to replicate this issue are as follows:

  1. Create a new user (from Odoo "Users" menu)

  2. Set the new user's password (which can be anything, apparently)

  3. Delete that new user.

The error I got was 

Integrity Error

The operation cannot be completed, probably due to the following:

- deletion: you may be trying to delete a record while other records still reference it

- creation/update: a mandatory field is not correctly set

[object with reference: Change Password Wizard User - change.password.user]

From what I Googled, it seems that the reason is because the "change.password.user" table (the actual database table name is "change_password_user") still contains a reference to the user I'm trying to delete. But why is that so? And how to fix this problem? Should I manually delete the entry in change.password.user table?

On 8/5/15, 10:22 AM

You could make a fix module, with this python code:

class ResPartner(models.Model):
_inherit = 'res.partner'

def unlink(self):
for record in self:
self.env.cr.execute("DELETE FROM change_password_user WHERE user_id=%s;",

don't forget to accept the answer if this suits your needs

on 8/7/15, 9:41 AM

How this works?

on 10/5/15, 8:57 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/5/15, 9:41 AM
Seen: 2272 times
Last updated: 8/14/15, 12:36 AM