working in Pycharm CE (latest) on Ubuntu 22.04
in my folder models i have a .py file which contains first line as:
from odoo import api, fields, models
pycharm is underlining all 3 api, fields and models
when mouse hover on models it is showing error as below:
cannot find reference 'models' in 'imported module odoo'
i can start the odoo server, upgrade my application/module and run it successfully.
i am curius why it is showing those errors? what it means?
regards
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Financeiro
- Inventário
- PoS
- Project
- MRP
Esta pergunta foi sinalizada
Hi,
The errors you're seeing in PyCharm regarding the api, fields, and models modules from Odoo are likely due to PyCharm's static code analysis not being able to resolve the import correctly. This can happen because Odoo uses a dynamic import system that PyCharm may not fully understand.
However, it's important to note that these errors/warnings in PyCharm do not necessarily indicate an actual issue with your code or the functionality of your Odoo application. If you can start the Odoo server, upgrade your module, and run it successfully, it suggests that your code is correct.
If you want to suppress these specific warnings in PyCharm, you can use a comment to disable the inspection for the affected line. Here's an example:
# noinspection PyUnresolvedReferences
from odoo import models, fields, api, _
Adding the # noinspection PyUnresolvedReferences comment before the import statement tells PyCharm to ignore the unresolved reference warning for that line.
Hope this will help you
Thanks
thanks very much for detailed explaination and help how i can ignore this kind of errors / warnings. it was a bit irritating for me and some times confusing too. anyway, now with your help i can ignore them.
Está gostando da discussão? Não fique apenas lendo, participe!
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscreva-sePublicações relacionadas | Respostas | Visualizações | Atividade | |
---|---|---|---|---|
|
1
jan. 23
|
4937 | ||
|
3
ago. 25
|
2221 | ||
|
1
mai. 25
|
2505 | ||
|
1
abr. 25
|
3495 | ||
|
1
abr. 25
|
4322 |