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

[FIX] disable_invalid_filters: <module 'time' (built-in)> can not be used in evaluation contexts #280

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

royle-vietnam
Copy link
Contributor

This error will save archive all filters
=> Prefer providing only the items necessary for your intended use as attributes of odoo.tools.safe_eval

@pedrobaeza
Copy link
Member

This has been working perfectly during several versions. Is it a problem in v14? Why? If so, you must restrict it to such version, not on the rest.

@royle-vietnam
Copy link
Contributor Author

This has been working perfectly during several versions. Is it a problem in v14? Why? If so, you must restrict it to such version, not on the rest.

Yes, it is a problem in v14 (all filters is archived)
How to restrict it to such version?

@pedrobaeza
Copy link
Member

But I don't get why. Having an extra argument shouldn't be the reason for that. I have migrated to v14 already some DBs and don't have this problem.

@royle-vietnam
Copy link
Contributor Author

royle-vietnam commented Feb 26, 2022

But I don't get why. Having an extra argument shouldn't be the reason for that. I have migrated to v14 already some DBs and don't have this problem.

Because if error occurs, except clause will be handled, so all filters is archived
Did you check all the filters in the db after the migration? You can check at menu Settings / Technical / User-defined Filters

@royle-vietnam
Copy link
Contributor Author

royle-vietnam commented Feb 26, 2022

But I don't get why. Having an extra argument shouldn't be the reason for that. I have migrated to v14 already some DBs and don't have this problem.

The following code generates that message, however, I see no need to use time in the safe_eval

https://github.com/odoo/odoo/blob/1c82a66cf975203b6a44f23c6a866c1d7b4637ed/odoo/tools/safe_eval.py#L366-L372

@royle-vietnam royle-vietnam force-pushed the fix_disable_invalid_filters branch from b8c558b to 232be4e Compare February 28, 2022 06:13
@royle-vietnam
Copy link
Contributor Author

@pedrobaeza I fixed to restrict it to version 14.0, please review, thank you

@royle-vietnam royle-vietnam force-pushed the fix_disable_invalid_filters branch from 232be4e to faf7ec3 Compare March 2, 2022 17:43
Copy link
Contributor

@MiquelRForgeFlow MiquelRForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@royle-vietnam
Copy link
Contributor Author

@pedrobaeza please review this PR, thank you

@all-dm
Copy link

all-dm commented Apr 28, 2022

We're migrating a db from v12 to v14 and found this problem too. It's something new in v14 that I didn't see before. Because of this we're getting around 408 user-defined filters archived, so would be great when this pull request can be reviewed and merged.

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked that no other replacement is found, so good to go

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pedrobaeza pedrobaeza merged commit ad153a2 into OCA:master Apr 28, 2022
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.

5 participants