-
Notifications
You must be signed in to change notification settings - Fork 5
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
FIX import error for odoo v10 #12
base: fix_for_odoo10
Are you sure you want to change the base?
FIX import error for odoo v10 #12
Conversation
Mixup in odoo import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make sure this is not a side effect on my environment. If not maybe trying to import openerp as odoo
first should be work!
I'll test and let you know!
from odoo.cli import server as startup | ||
except ImportError: | ||
from .backports.cli import server as startup | ||
from odoo.tools import config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've test something similar, looks pretty much cleaner however this code result to make integration test failing on v8
pverkest@petrus-v:~/tmp/aro_8$ bin/nosetests -d aro8 -- -s -v ../aro/tests_with_odoo/
Traceback (most recent call last):
File "bin/nosetests", line 60, in <module>
from anybox.recipe.odoo.runtime.session import Session
File "/home/pverkest/tmp/aro/anybox/recipe/odoo/runtime/session.py", line 21, in <module>
from odoo.tools import config
ImportError: No module named tools
This sounds strange to me, it's like import odoo
do not raise ImportError exceptions... I'll go in deep on that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python appear to not be able to load python module from aliases:
>>> from xml.dom import domreg
>>> domreg
<module 'xml.dom.domreg' from '/usr/lib/python2.7/xml/dom/domreg.pyc'>
>>> import xml as tmp
>>> from tmp.dom import domreg
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tmp.dom
>>>
I've test that which works in our case
try:
import openerp as odoo
except ImportError:
try:
import odoo
except ImportError:
warnings.warn("This must be imported with a buildout odoo recipe "
"driven sys.path", RuntimeWarning)
try:
startup = odoo.cli.server
except ImportError:
from .backports.cli import server as startup
config = odoo.tools.config
SUPERUSER_ID = odoo.SUPERUSER_ID
parse_version = odoo.tools.parse_version
@PieterPaulussen what do you think about?
Mixup in odoo import
Shorter import statement
if Odoo is not found, Openerp should be imported as Odoo