odoo-ide / vscode-odoo

Visual Studio Code extension for Odoo
https://marketplace.visualstudio.com/items?itemName=trinhanhngoc.vscode-odoo
39 stars 2 forks source link

cannot resolve from odoo.addons.* when the module is in oca folder or enterprise #81

Open davdenic opened 2 weeks ago

davdenic commented 2 weeks ago

Hi, on my local i'm developing on visual code and I'm using some modules from oca and enterprise. it cannot resolve the imports from there. "Import "odoo.addons.fastapi.tests.common" could not be resolved"

the addon path is correctly configured, in fact all modules work perfectly.

instead native odoo addons and my homemade modules that are in the addons folder are correctly displayed in the autocomplete for that reason i believe is a misconfiguration but i cannot figurate out how to fix it.

i'm developing on mac, my folder structure is

. ├── addons ├── build ├── config ├── enterprise ├── k3s ├── oca ├── odoo ├── scripts ├── snippets ├── template ├── themes ├── thirdparty ├── tmp └── venv16.0

my addon path shows

INFO ? odoo: addons paths: ['/Volumes/DEV/odoo-myproject/odoo/odoo/addons', '/Volumes/DEV/odoo-myproject/venv16.0/lib/python3.11/site-packages/odoo/addons', '/Users/dd/Library/Application Support/Odoo/addons/16.0', '/Volumes/DEV/odoo-myproject/themes', '/Volumes/DEV/odoo-myproject/odoo/addons', '/Volumes/DEV/odoo-myproject/oca/partner-contact', '/Volumes/DEV/odoo-myproject/addons/server_tools', '/Volumes/DEV/odoo-myproject/oca/web', '/Volumes/DEV/odoo-myproject/oca/server-tools', '/Volumes/DEV/odoo-myproject/oca/sale-workflow', '/Volumes/DEV/odoo-myproject/oca/purchase-workflow', '/Volumes/DEV/odoo-myproject/oca/server-env', '/Volumes/DEV/odoo-myproject/addons/sale_workflow', '/Volumes/DEV/odoo-myproject/addons/hr', '/Volumes/DEV/odoo-myproject/addons/purchase_workflow', '/Volumes/DEV/odoo-myproject/enterprise', '/Volumes/DEV/odoo-myproject/oca/bank-payment', '/Volumes/DEV/odoo-myproject/oca/server-backend', '/Volumes/DEV/odoo-myproject/oca/account-invoicing', '/Volumes/DEV/odoo-myproject/addons/partner_contact', '/Volumes/DEV/odoo-myproject/addons/account_invoicing', '/Volumes/DEV/odoo-myproject/addons/mymodules', '/Volumes/DEV/odoo-myproject/oca/web-api', '/Volumes/DEV/odoo-myproject/oca/rest-framework', '/Volumes/DEV/odoo-myproject/oca/server-auth']

in the oca folder there are the modules i'm using, and as said are perfectly working in my odoo instance

oca ├── account-invoicing ├── bank-payment ├── partner-contact ├── purchase-workflow ├── rest-framework ├── sale-workflow ├── server-auth ├── server-backend ├── server-env ├── server-tools ├── web └── web-api

trinhanhngoc commented 2 weeks ago

Hello @davdenic ,

If the extension cannot detect addons paths automatically, you can manually add addons paths to the python.analysis.extraPaths setting.

davdenic commented 2 weeks ago

i've already tried but it doesn't work

"python.analysis.extraPaths": [ "./odoo", "./oca", "./oca/rest-framework", "./oca/rest-framework/fastapi", "/Volumes/DEV/odoo-myproject/oca", "/Volumes/DEV/odoo-myproject/oca/rest-framework", "./enterprise", "....", "...", "..", ],

trinhanhngoc commented 2 weeks ago

@davdenic ,

Can you provide screenshots of the import errors, your VSCode workspace structure and the extraPaths setting?

davdenic commented 2 weeks ago

this is the screenshot of the error, the workspace structure reflect what i've already submitted in the first message, the extraPaths is written just 2 posts above

Screenshot 2024-06-21 at 14 51 35
trinhanhngoc commented 2 weeks ago

@davdenic ,

I just tested, everything is still working fine.

image image
destroT commented 3 days ago

@davdenic I had the same problem, and I fixed it by running 'Python: Clear Cache and Reload Window' from the command palette in VSCode after updating the extraPaths