+1 vote
54 views

Why PyCharm underlines these odoo imports while beside these imports it works just fine 

These imports are unresolved :

from odoo import api, fields, models

While these work normaly :

from dateutil.relativedelta import relativedelta

in App by (10.2k points) | 54 views

1 Answer

+1 vote
Best answer

If you have Odoo source code in somewhere outside environment path and want PyCharm to recognize it, you can add Odoo source code to the project structure of PyCharm.

  1. Open File - Settings.
  2. In the sidebar, go to Project - Project Structure.
  3. Click Add Content Root button.
  4. Then browse and select the Odoo source code directory.
  5. After the Odoo source code directory added to project structure, click OK to save and close the setting window.
  6. Then PyCharm will index your Odoo source code and resolve the reference to Odoo.
Before add Odoo to project structure:
After add Odoo to project structure:
Hope this answer your question.
by (460 points)
selected by
192 questions
163 answers
32 comments
39,440 users