odoo-ls icon indicating copy to clipboard operation
odoo-ls copied to clipboard

Typing lost on `filtered` / `grouped` / `filtered_domain`

Open andg-odoo opened this issue 3 months ago • 2 comments

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 (or filtered_domain), it will return always return a recordset of the model that was filtered even if empty, as such, the default typing of TypeVar | Any is incorrect as it should always be the same model as the original. This occurs for self.filtered(), self.field.filtered(), recordset.filtered(), and all filtered_domain calls as well

  • If possible this should also apply to grouped which 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: Image

Image

Grouped typing:

Image

andg-odoo avatar Sep 16 '25 08:09 andg-odoo

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 avatar Oct 29 '25 14:10 mmahrouss

@mmahrouss No worries, grouped definitely felt like a longshot. Glad to hear filtered is working soon :)

andg-odoo avatar Oct 29 '25 16:10 andg-odoo