-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Odoo Core Modules are not in the Remote Python interpreter. #152
Comments
Hey, Daniil! Thanks for bringing this issue to our attention. I've been working to understand what's going on. I discovered, just like you mentioned, that Odoo modules in I noticed the same results when running these two scripts: from odoo import modules
modules.get_modules() and import pkg_resources
installed_packages = pkg_resources.working_set
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print(installed_packages_list)
print(len(installed_packages_list)) using:
I am wondering if it is possible that this behavior is related to the fact that these modules, despite -or precisely because- they belong to Odoo core, are not straightforward available in a virtualenv, but through Odoo logic. For instance, consider this example: from odoo import models, fields, api
class InstanceCalendarEvent(models.Model):
_inherit = 'calendar.event' This returns an error, emphasizing that the import should start with 'odoo.addons'.: assert self.__module__.startswith('odoo.addons.'), \
AssertionError: Invalid import of __main__.InstanceCalendarEvent, it should start with 'odoo.addons'. To help us get a handle on this, could you provide a little more information?
I'm also intrigued about the use of the SFTP protocol. It's the only piece that it's unfamiliar to me. Thanks again for reporting!! Salut! |
Thanks for the answer. The problem is not related to execution, odoo detects all the module even if they are not in the venv because we specify the two addons paths in the My problem is from the python interpreter, that only uses the modules found in the venv. I use the IDE Pycharm, but it happens too in Visual Code, and when using this plugin it detects that these odoo core module are missing (when in execution they are not) and marks them as errors. The SFTP protocol is how the IDE copies the venv locally to be able to use it. I talked with other coopdevs employees, and it seems like I'm the only one that uses the remote interpreter or this plugin, because it assures me that I'm working in the exact same interpreter as the local lxc and makes suggestions and detects errors before I execute on the machine. |
Ah! That sounds more familiar. It seems more like a problem related to PyCharm/Odoo IDE configuration than with the I've been taking a look at the Odoo IDE repository and I've seen some issues that might refer to a similar case. Have you asked there? Regarding PyCharm, I can't remember the details right now, but it seems to me that there was a need to add/map folders for it to be aware of. For VsCode, I just documented how to use it for debugging in I believe that the fact that these addons are not directly available under the interpreter is the expected behavior. Maybe you could give SSH a shot, using PyCharm's |
Hey, @DaniilDigtyar, how did it go? Did the documentation help you? Do you agree that this isn't a problem from |
When using the remote python interpreter of the lxc container, some Odoo modules are not added by default to the venv.
Remote Python 3.7.7 (sftp://[email protected]:22/home/odoo/pyenv/versions/odoo/bin/python3.7)
All the modules located in
/opt/odoo/addons
these are all the core Odoo modulesaccount, crm, l10n_es...
are not added to the venv and not found by the interpreter because they are not installed via pip.The modules located in
/opt/odoo/odoo/addons
, (base and all the testing modules) are added.To fix this, I copy all the modules in
/opt/odoo/addons
to the/home/odoo/pyenv/versions/odoo/lib/python3.7/site-packages/odoo/addons
folder.Don't know I is something with my configuration that I do wrong, feedback is apreciated.
The text was updated successfully, but these errors were encountered: