+1 vote
165 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

closed with the note: Problem solved
in App by (10.5k points)
closed by | 165 views

1 Answer

+3 votes
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 (500 points)
selected by
202 questions
178 answers
34 comments
112,142 users