Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved ORM module members #95

Open
dannyadair opened this issue Mar 7, 2025 · 6 comments
Open

Unresolved ORM module members #95

dannyadair opened this issue Mar 7, 2025 · 6 comments

Comments

@dannyadair
Copy link

Everything seems to be working fine (thank you!) except for this Pyright complaint:

Image

When I "Go to Definition" you can see SENTINEL is very much an attribute, but it was imported from tools.misc:

Image

A few lines down in fields.py the same issue BUT not for NewId:

Image

Even though all of them are defined on the top level of api.py:

Image

Maybe also worth noting that none of them are in __all__:

Image

What am I doing wrong, what config am I missing?
Thank you for your help!

@dannyadair
Copy link
Author

P.S.: Sorry I should add: I'm using the VSCode fork Cursor, and while Pyright itself is disabled, there is a "Cursor Pyright":

Image

However, I do have "python.languageServer": "None" in my .code-workspace file (I think Odoo IDE wrote that actually)

@trinhanhngoc
Copy link
Member

Hello @dannyadair ,

I think the errors related to SENTINEL, ContextType,... are Odoo's issues. They should be fixed in the Odoo source code. Regarding Cursor Pyright, you should disable it manually. The python.languageServer setting is to disable two built-in language servers Pylance and Jedi, it cannot disable other language servers (Pyright, Cursor Pyright).

@dannyadair
Copy link
Author

Thank you @trinhanhngoc
I disabled Cursor Pyright but I'm still getting the same Pyright warning. So this is coming from the Pyright underneath Odoo IDE?

Installed modules:

  • Better Jinja
  • Command Variable
  • Debugger for Firefox
  • Docker
  • Docker Compose
  • ESLint
  • favorites
  • gettext
  • Invoke (Python Task Executor)
  • Odoo IDE
  • Prettier
  • Pylance
  • Pylint
  • Python
  • Python Debugger
  • Remote - SSH
  • Remote Explorer
  • reStructuredText
  • Ruff
  • Tasks
  • XML
    (- "Cursor Pyright" manually disabled)

This is what I have in Output for Odoo IDE:

[Info  - 14:46:59] Pyright language server 1.1.396 starting
[Info  - 14:46:59] Server root directory: file:///home/danny/.cursor/extensions/trinhanhngoc.vscode-odoo-0.38.4-linux-x64/dist
[Info  - 14:46:59] Data storage path: /home/danny/.config/Cursor/User/workspaceStorage/4e81fdc80da6eab5283bae68e6fa693f/trinhanhngoc.vscode-odoo
[Info  - 14:46:59] Starting service instance "odoo-18.0"
Received pythonPath from Python extension: /bin/python3.12
[Info  - 14:47:00] Background analysis(2) root directory: file:///home/danny/.cursor/extensions/trinhanhngoc.vscode-odoo-0.38.4-linux-x64/dist
[Info  - 14:47:00] Background analysis(2) started
[Info  - 14:47:00] Setting pythonPath for service "odoo-18.0": "/bin/python3.12"
[Info  - 14:47:00] No include entries specified; assuming /home/danny/src/odoo-18.0
[Info  - 14:47:00] Auto-excluding **/node_modules
[Info  - 14:47:00] Auto-excluding **/__pycache__
[Info  - 14:47:00] Auto-excluding **/.*
[Warn  - 14:47:00] stubPath file:///home/danny/src/odoo-18.0/typings is not a valid directory.
[Info  - 14:47:01] Assuming Python version 3.12.7.final.0
[Info  - 14:47:05] Found 16272 source files
[Info  - 15:24:59] Starting service instance "<default>"
Received pythonPath from Python extension: /bin/python3.12
[Info  - 15:25:00] Setting pythonPath for service "<default>": "/bin/python3.12"
[Info  - 15:25:00] No include entries specified; assuming /<default workspace root>
[Info  - 15:25:00] Auto-excluding **/node_modules
[Info  - 15:25:00] Auto-excluding **/__pycache__
[Info  - 15:25:00] Auto-excluding **/.*
[Info  - 15:25:00] Assuming Python version 3.12.7.final.0
[Error - 15:25:00] File or directory "/<default workspace root>" does not exist.
[Info  - 15:25:00] No source files found.
[Info  - 15:25:00] Background analysis(3) root directory: file:///home/danny/.cursor/extensions/trinhanhngoc.vscode-odoo-0.38.4-linux-x64/dist
[Info  - 15:25:00] Background analysis(3) started
[Info  - 15:25:03] [BG(2)] Long operation: checking: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2017ms)
[Info  - 15:25:03] [BG(2)] Long operation: analyzing: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2083ms)
[Info  - 15:29:00] [BG(2)] Long operation: analyzing: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2023ms)
[Info  - 15:33:19] [BG(2)] Long operation: checking: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2056ms)
[Info  - 15:33:19] [BG(2)] Long operation: analyzing: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2102ms)
[Info  - 15:42:29] [BG(2)] Long operation: analyzing: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2045ms)
[Info  - 15:55:03] [BG(2)] Long operation: checking: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2204ms)
[Info  - 15:55:03] [BG(2)] Long operation: analyzing: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2250ms)
[Info  - 16:04:57] [BG(2)] Long operation: checking: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2156ms)
[Info  - 16:04:57] [BG(2)] Long operation: analyzing: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2209ms)
[Info  - 16:23:21] [BG(2)] Long operation: checking: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2276ms)
[Info  - 16:23:21] [BG(2)] Long operation: analyzing: file:///home/danny/src/odoo-18.0/odoo/src/odoo/odoo/fields.py (2327ms)

@trinhanhngoc
Copy link
Member

@dannyadair ,

Yes, Odoo IDE is built on the top of Pyright. You can create issues for Odoo: https://github.com/odoo/odoo/issues

@dannyadair
Copy link
Author

dannyadair commented Mar 10, 2025

Ok thank you. I'll close this issue now.

I was just wondering about the warning because the import is not a real error, and ContextType etc. are defined in odoo.api just fine (though not listed in __all__). I'll just ignore that

@trinhanhngoc
Copy link
Member

@dannyadair ,

Sorry, that's my wrong. The import errors caused by missing module members in https://github.com/odoo-ide/odoo-stubs. I will update odoo-stubs to fix it. Thanks for the report.

@trinhanhngoc trinhanhngoc reopened this Mar 10, 2025
@trinhanhngoc trinhanhngoc changed the title Pyright false positive? Unresolved ORM module members Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants