Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
2407 Widoki

i know its not PyCharm community forum but most of the developers using it so asking here for a practical experience.

anybody faced the error in PyCharm when i have written first line

from odoo import models, fields, api

the PyCharm showed it underlined and when mouse over on word odoo, it says

unresolved reference 'odoo'


but when restart service, there is no error and loaded all things in browser smoothly.

but i want to get rid of this 'false positive' type error.

i searched on net and found a link of stackoverflow, i tried a solution 

File | Invalidate Caches... and restarting PyCharm helps.

it works for first time, but when modify Model file now it is showing same error again.

please help to be focused on work.


regards


Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

1. Open PyCharm.

2. In the Project view, find D:\odoo18\server\odoo.

3. Right-click on the odoo folder → Select Mark Directory as → Sources Root.

4. Restart PyCharm and check if the from odoo import models error is resolved.


Tested. Thanks.

Awatar
Odrzuć
Najlepsza odpowiedź

Hi SmithJohn45,

File | Settings | Editor | Inspections - Python - Unresolved references).

Thanks.

Awatar
Odrzuć
Autor

thank @Nikhil but still i totally failed what to set here, the link you provided is also not understandable at least for me for 'what to set here?'

inside settings -> editor -> inspections -> python -> unresolved reference - check false and save.

Najlepsza odpowiedź

Hi,

Odoo Not Installed in Python Environment:

Check Installation: Use pip show odoo in your terminal to verify if Odoo is installed. If not, install it using pip install odoo.
Virtual Environment: If you're using a virtual environment, activate it before running PyCharm or installing Odoo.


Hope it helps

Awatar
Odrzuć
Autor

i have installed Odoo and running it that's why as mentioned "when restart service, there is no error and loaded all things in browser smoothly", all things working fine but it shows multiple errors which is very disturbing. the Python Env i have not yet used it...

Autor

please correct,
virtual environment in Windows i have not yet used.

Powiązane posty Odpowiedzi Widoki Czynność
2
cze 20
6303
2
gru 24
913
1
sty 20
4070
1
wrz 19
3371
2
wrz 19
3222