Open
Conversation
|
|
1229e40 to
c9ba24d
Compare
8794251 to
80b805c
Compare
Collaborator
Author
|
I've just realized that the 2nd commit in this PR handles the same issue as @mmahrouss 's PR: #488 |
CachedModel is not required to define Odoo models, so we should not fail to detect models if CachedModel is not found in the Odoo source code. Treat `Model` and `TransientModel` similarly. only exit if `BaseModel` does not exist.
While validating search domain, for relational fields, i.e. "m2ofield.normalfield", we should check all the symbols m2ofield on the model, not just one, so we set true on get member symbol
We are trying to do that by checking _register = False. The check was failing because we handled only one evaluation. However, in latest versions we also have a type hint, which is its own evaluation. For that, we implement here a smarter search that only looks are evaluations with values. In that case, we should be more generic in catching cases. Consider using this as the check, instead of checking symbol trees
Check if class model is in a module, otherwise do not mark it as a model This is to avoid crashing later due to the class not being in a model. The crash to avoid is in `core.model.Model.get_symbols`
The base model's search method should have an evaluation of EvaluationSymbolPtr::SELF. This used to be the case, but it got lost in a refactor ([1]). [1]: ca26c3e
Before we were checking if inverse_name arg points to a M2O field, but it can also be a Many2oneReference Fixed false positives for OLS03022
80b805c to
783a486
Compare
__init_subclass__ and __class_getitem__ have a special behavior where they are implicitly classmethods without the decorator This is added here to avoid, for example, wrong diagnostics
Fix arg index to account for is on instance if it is true
Collaborator
Author
|
This PR must be adapted to odoo/odoo#240683, that moves |
783a486 to
752b720
Compare
- add evaluation for odoo.http.request: - up to 15.2: WebRequest class - since 15.3: Request class - add env variable to Request class (15.3+ only, as it already exists as property before that) - add evaluation to (Request/WebRequest).env: Environment | None This allows for better type evaluation in controllers, which use odoo.http.request extensively.
752b720 to
0d7490c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds some missing features related to controllers.
requestnow evaluates toRequestclassrequest.envnow evaluates toEnvironment | Nonerequest.env["res.partner"]evaluates to the modelNext steps:
In a Controller,
self.envstill does not work, asenvis a property (which simply returnsrequest.env), and properties are not resolved to their return types.Support for resolving property types is introduced by #511, which should then:
self.envin aControllerclassrequest.envbefore 15.3, in whichrequestis an instance ofWebRequest, which in turn hasenvas a property.