[IMP] detect when request is using in models
Closed this issue · 3 comments
Currently is possible to import request
from odoo.http
in models but the request is only available with information from Controllers (frontend) so, we can implement a way to identify when the request.env
is used in models to notify the user.
I think it could be detected with the original pylint checks but using a dynamic way
I mean, you need to have configured the odoo
package in the PYTHONPATH
to be computed from pylint/astroid
The check related could be no-member
@fernandahf
Could you double-confirm if this check works as you expect here, please?
Even we could dev this static check in order to detect these kind of cases using self.env
for controller classes
I can not assign to @antonag32 to issues because "it is not a member of this organization"
What is the correct way to do it?
Workaround, for now, I just have added access temporally in
There are code lines that are doing the exactly I reported as improvement, so it's a valid case:
Closing this.