How to get a Python shell with the Odoo environment?
I started playing around a bit.
It seems you're using a source distribution where all addons have been moved out of the "openerp.addons" Python package to the root directory of the distribution (current layout in GitHub, branch 7.0), hence it cannot load some required modules. Specifying "--addons-path/addons_path" is required in order to fix this.
You can fake command line arguments in the Python interactive interpreter in the following way:
>>> import sys
>>> import openerp
>>> sys.argv = ['', '--addons-path=/opt/openerp/server/addons', '--log-level=debug']
Please note that the first argument is an empty string.
Not compatible with V7, because it's new in saas-6...
But that can help other peoples looking about it...
./odoo.py shell -d saas6
after, all is possible ...
OLD API :
>>> blog_post_ids = env.registry['blog.post'].search(env.cr, env.uid, , context=env.context)
>>> env.registry['blog.post'].browse(env.cr, env.uid, blog_post_ids, context=env.context).mapped('name')
[u'The Future of Emails', u'Integrating your CMS and E-Commerce']
[u'Integrating your CMS and E-Commerce', u'The Future of Emails']
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 6/11/14, 10:46 AM|
|Seen: 3791 times|
|Last updated: 10/4/16, 5:43 PM|