Skip to content

Feature: Autocomplete Selection field values in Python comparisons #633

Description

@Alvix11

When comparing a fields.Selection field value in Python code,
it would be useful to have autocompletion suggest the valid
selection values.

Example

Given a field like:

payment_state = fields.Selection([
    ('not_paid', 'Not Paid'),
    ('in_payment', 'In Payment'),
    ('paid', 'Paid'),
    ('partial', 'Partially Paid'),
])

When writing:

if move.payment_state == "pa"
Image

The LSP should suggest: paid, partial

Why

It avoids having to go to the field definition (gd)
every time you need to know the valid values of a Selection field.
This would speed up development significantly.

Environment

  • odoo_ls_server version: 1.2.0
  • Editor: Neovim + NvChad

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions