Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipbastola/90767e7ad013cfdbe2e58369b0f19137 to your computer and use it in GitHub Desktop.
Save ipbastola/90767e7ad013cfdbe2e58369b0f19137 to your computer and use it in GitHub Desktop.
Custom Addons Unresolved odoo reference issue in PyCharm

Reference https://stackoverflow.com/questions/21236824/unresolved-reference-issue-in-pycharm

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
    -- ...

Solution:

  1. Right click on main odoo directory ( which is either odoo clone from github or odoo unzipped folder)
  2. Click on Mark Directory as option
  3. Click on Sources Root

Now it will be referenced on your custom addons.

Enjoy creating wonerful modules/addons 😁 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment