Typing lost on `filtered` / `grouped` / `filtered_domain`
Post OXP feature/bug request (Not 1.0 blocking):
Your setup
Version: main branch via cargo install --git
Operating System: Ubuntu 24.04
IDE and/or Integration tool (for example: Vscode - official extension): neovim lsp
Describe the bug
-
If a recordset is
filtered(orfiltered_domain), it will return always return a recordset of the model that was filtered even if empty, as such, the default typing ofTypeVar | Anyis incorrect as it should always be the same model as the original. This occurs forself.filtered(),self.field.filtered(),recordset.filtered(), and allfiltered_domaincalls as well -
If possible this should also apply to
groupedwhich will return the model as the value of the returned dictionary. A nice to have would be key typing based on if the string it is grouped by refers to a field in the model that way the dictionary would be typed as{field: model}but that sounds difficult.
To Reproduce
Steps to reproduce the behavior: grouped or filtered a recordset.
Expected behavior
Typing occurs on filtered / filtered_domain / grouped
Screenshots
Filtered typing:
Grouped typing:
Hello Andrew @andg-odoo
Yes that is an interesting issue. I am working on it.
However, grouped is not as simple as it seems, because we need to be able to handle parameterized/generic types. SO that will be later. but soon we will have it working for filtered and filtered_domain
@mmahrouss No worries, grouped definitely felt like a longshot. Glad to hear filtered is working soon :)