Reference https://stackoverflow.com/questions/21236824/unresolved-reference-issue-in-pycharm
I have my custom modules on custom_addons
folder which are not referencing to odoo imports in PyCharm
custom_addons/my_module/my_model.py
...
from odoo import models, fields, api, _, exceptions
...
It gives the red underline and warning message like Cannot find reference 'models' in 'imported module odoo'
...
I have the following odoo project/directory structure:
MyProject
-- conf
-- custom_addons
-- odoo ( Odoo clone/unzip folder) --> Right click --> Mark Directory as --> Sources Root
-- ...
-- odoo
-- odoo-bin
-- ...
- Right click on main
odoo
directory ( which is either odoo clone from github or odoo unzipped folder) - Click on
Mark Directory as
option - Click on
Sources Root
Now it will be referenced on your custom addons.
Enjoy creating wonerful modules/addons 😁 🙏