-
Notifications
You must be signed in to change notification settings - Fork 45
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
Silence Environment.manage warning in Odoo 15 #45
Conversation
Codecov Report
@@ Coverage Diff @@
## master #45 +/- ##
==========================================
+ Coverage 83.85% 84.81% +0.95%
==========================================
Files 6 7 +1
Lines 223 237 +14
Branches 31 33 +2
==========================================
+ Hits 187 201 +14
Misses 25 25
Partials 11 11
Continue to review full report at Codecov.
|
aa3b89c
to
cbf4810
Compare
Also, refactor to isolate most compatibility code in a dedicated module where it will be easier to locate when we drop older versions.
cbf4810
to
e970c6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes @sbidoul 👍
I am trying this patch but I am still getting warnings when using this in conjunction with click-odoo-contrib
, when hitting this line:
click-odoo/click_odoo/env_options.py
Line 213 in e970c6c
with odoo.api.Environment.manage(): |
2021-10-08 09:06:25,941 1 WARNING ? py.warnings: /usr/local/lib/python3.8/contextlib.py:113: DeprecationWarning: Since Odoo 15.0, Environment.manage() is useless.
File "/usr/local/bin/click-odoo-dropdb", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click_odoo/env_options.py", line 213, in _invoke
with odoo.api.Environment.manage():
File "/usr/local/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
2021-10-08 09:06:32,738 1 WARNING ? py.warnings: /usr/local/lib/python3.8/contextlib.py:113: DeprecationWarning: Since Odoo 15.0, Environment.manage() is useless.
File "/usr/local/bin/click-odoo-initdb", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click_odoo/env_options.py", line 213, in _invoke
with odoo.api.Environment.manage():
File "/usr/local/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
That's weird. Are you sure you are on the 15.0 branch and not 14.5 ? |
Yes, I am using the OCA/OCB fork but on branch 15.0. The warning actually makes sense because the line I mentioned still makes a direct call to Or is this line not supposed to be hit at all? |
Ah right, I see it now. It should be fixed now. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍 Tested and works as expected now 🙂
closes #43
And a few other internal improvements.