Skip to content

[IMP] controllers#497

Merged
fda-odoo merged 1 commit intoalphafrom
alpha-request_type-rcdl
Mar 31, 2026
Merged

[IMP] controllers#497
fda-odoo merged 1 commit intoalphafrom
alpha-request_type-rcdl

Conversation

@cammarosano
Copy link
Copy Markdown
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
Copy Markdown

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 3 times, most recently 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
@cammarosano
Copy link
Copy Markdown
Collaborator Author

cammarosano commented Jan 13, 2026

I've just realized that the 2nd commit in this PR handles the same issue as @mmahrouss 's PR: #488
Dropping it. For the record: 80b805c.

@cammarosano
Copy link
Copy Markdown
Collaborator Author

cammarosano commented Jan 27, 2026

This PR must be adapted to odoo/odoo#240683, that moves request (and Request) from http.py to requestlib.py
Edit: done.

@cammarosano cammarosano marked this pull request as draft January 27, 2026 16:30
@cammarosano cammarosano force-pushed the alpha-request_type-rcdl branch 2 times, most recently from 752b720 to 0d7490c Compare January 28, 2026 17:35
@cammarosano cammarosano marked this pull request as ready for review January 29, 2026 12:45
@andg-odoo
Copy link
Copy Markdown

@cammarosano Hi! I've been doing a few PRs recently on the IAP side which is basically all controllers, and definitely missing the environment access on request. Just wondering if this PR is still in the works? I checked out the branch locally and it's been working well for what I need for the past bit so it would be nice to have it merged with all the other cool features of alpha.

Thanks again for all your work on this! :)

@fda-odoo fda-odoo added this to the 1.3.0 milestone Mar 30, 2026
@fda-odoo
Copy link
Copy Markdown
Collaborator

We'll try to include this branch in the 1.3. @cammarosano can you rebase it on alpha?

- 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.
@cammarosano cammarosano force-pushed the alpha-request_type-rcdl branch from 0d7490c to 1a446f7 Compare March 31, 2026 08:29
@cammarosano
Copy link
Copy Markdown
Collaborator Author

We'll try to include this branch in the 1.3. @cammarosano can you rebase it on alpha?

Done

Copy link
Copy Markdown
Collaborator

@fda-odoo fda-odoo left a comment

Choose a reason for hiding this comment

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

well done !

@fda-odoo fda-odoo merged commit 90ddb23 into alpha Mar 31, 2026
2 checks passed
@fda-odoo fda-odoo deleted the alpha-request_type-rcdl branch March 31, 2026 09:24
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.

3 participants