Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][FIX] database_cleanup: Prevent deletion of columns added in the init method of the model #2994

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

pedrobaeza
Copy link
Member

Cherry-pick of #2852 (backported for 14.0 in #2993), but with proper commit message.

With Odoo 16.0, running the "Purge columns" database cleanup, a field called totp_secret shows up for purging when the auth_totp module is installed. This field seems to be defined as a computed non-stored field
(https://github.com/odoo/odoo/blob/93aa48c972889f941b97a60738d33f571204bb2c/addons/auth_totp/models/res_users.py#L24), but also has a query referring to it.
(https://github.com/odoo/odoo/blob/93aa48c972889f941b97a60738d33f571204bb2c/addons/auth_totp/models/res_users.py#L160)

The totp_secret field would have to be defined as stored=True, but it is not defined as such. Instead, it's added in res.users init method:
https://github.com/odoo/odoo/blob/93aa48c972889f941b97a60738d33f571204bb2c/addons/auth_totp/models/res_users.py#L32

The solution is to add the "totp_secret" field to the blacklisted fields of res.users.

@Tecnativa

… method of the model

With Odoo 16.0, running the "Purge columns" database cleanup, a field called totp_secret
shows up for purging when the auth_totp module is installed. This field seems to be
defined as a computed non-stored field
(https://github.com/odoo/odoo/blob/93aa48c972889f941b97a60738d33f571204bb2c/addons/auth_totp/models/res_users.py#L24),
but also has a query referring to it.
(https://github.com/odoo/odoo/blob/93aa48c972889f941b97a60738d33f571204bb2c/addons/auth_totp/models/res_users.py#L160)

The totp_secret field would have to be defined as stored=True, but it is not defined as such.
Instead, it's added in res.users init method:
https://github.com/odoo/odoo/blob/93aa48c972889f941b97a60738d33f571204bb2c/addons/auth_totp/models/res_users.py#L32

The solution is to add the "totp_secret" field to the blacklisted fields of res.users.
@pedrobaeza pedrobaeza added this to the 15.0 milestone Jul 20, 2024
@pedrobaeza
Copy link
Member Author

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 15.0-ocabot-merge-pr-2994-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit bfb3665 into OCA:15.0 Jul 20, 2024
9 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 7578a2f. Thanks a lot for contributing to OCA. ❤️

@pedrobaeza pedrobaeza deleted the 15.0-fix-totp-secret branch July 20, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants