Skip to Content
Menu
This question has been flagged
1 Reply
5297 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?

Avatar
Discard
Best Answer

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


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

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

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

How this works?