In cases where you have lost access to the Odoo user interface and cannot recover your password through standard methods, you can manually update the password by accessing the database. Since passwords are not stored in plain text in database, this process involves hashing a new password prior to updating it directly in the Odoo database.
from passlib.context import CryptContext
# User details
new_password = '' # the new password
# Odoo password hasher
pwd_context = CryptContext(schemes=["pbkdf2_sha512"], deprecated="auto")
# Hash the new password
hashed_password = pwd_context.hash(new_password)
Access the Database:
psql
as proper user.sudo su - <user>
psql -d <database>
Locate the User:
SELECT id FROM res_users WHERE login = 'your_username';
id
.Update the Password:
UPDATE res_users SET password = 'your_hashed_password' WHERE id = your_user_id;
Verify the Change:
By following these steps, you can manually reset a password in Odoo’s database, ensuring continued access and security for your system.