Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How do I import an addon module (from a python shell)?

Kasper Souren
on 7/7/14, 4:52 PM 2,780 views

I want to learn more about the structure of Odoo, mainly to find out how I can import data. The best way to do that is through a python shell.

$ cd /opt/odoo

$ ipython

In [1]: import openerp

In [2]: openerp.modules.module?

[not much luck]

In [3]: openerp.addons?

[not much luck either]

In [4]: import openerp.addons.decimal_precision as dp  # line from addons/product/product.py


ImportError: No module named decimal_precision


I'm guessing I need to somehow initialize `openerp.addons` so that it will contain all addon modules from the addons directory. I've been grepping through the source code but haven't found how this is done from `openerp.cli.main()`.

Kasper, there are several ways to import data: over xml-rpc : as webservice through the web interface through an addon module You are referring to 3, I assume. So the first thing would be either to find an existing module that does already a good part of what you want or start a new module from scratch. For new modules you need to set up the standard skeleton of __init__.py inside the module, the main python script, xml views, data files, security files, maybe wizards etc, as explained in the developer documentation.

Wouter Tebbens
on 7/8/14, 5:41 AM
Kasper Souren
On 7/14/14, 1:13 PM

This function initializes addons: openerp.tools.config.parse_config()

E.g. with passing arguments:

import openerp


import openerp.addons.product

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 7/7/14, 4:52 PM
Seen: 2780 times
Last updated: 3/16/15, 8:10 AM