Skip to content

Conversation

@cammarosano
Copy link
Collaborator

@cammarosano cammarosano commented Dec 3, 2025

This PR adds some missing features related to controllers.

  • request now evaluates to Request class
  • request.env now evaluates to Environment | None
  • subscript on request's env is now supported. E.g. request.env["res.partner"] evaluates to the model

Next steps:
In a Controller, self.env still does not work, as env is a property (which simply returns request.env), and properties are not resolved to their return types.
Support for resolving property types is introduced by #511, which should then:

  • enable self.env in a Controller class
  • enable request.env before 15.3, in which request is an instance of WebRequest, which in turn has env as a property.

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

⚠️ A 'println!(' statement was found in the commit. Please ensure debug statements are removed before merging.

@cammarosano cammarosano force-pushed the alpha-request_type-rcdl branch 2 times, most recently from 1229e40 to c9ba24d Compare December 3, 2025 14:40
@cammarosano cammarosano self-assigned this Dec 3, 2025
@cammarosano cammarosano added enhancement New feature or request tests labels Dec 3, 2025
@cammarosano cammarosano force-pushed the alpha-request_type-rcdl branch 2 times, most recently from 41126a7 to 8794251 Compare December 11, 2025 13:48
- 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 is a property
before that)
- add evaluation to (Request/WebRequest).env: Environment | None

This allows us for better tooling in controllers, which use
odoo.http.request extensively.
This enables getting an evaluation for `request.env["some.model"]`, even
though `env` has two possible evaluations (Environment and None).
@cammarosano cammarosano force-pushed the alpha-request_type-rcdl branch from 8794251 to 80b805c Compare December 12, 2025 11:01
@cammarosano cammarosano changed the title request.env [IMP] controllers Dec 12, 2025
@cammarosano cammarosano requested a review from fda-odoo December 12, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant