Odoo Help

Welcome!

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.

1

Openerp handling of submodules?

By
Carlos Llamacho
on 9/11/13, 6:52 PM 1,578 views

Can i have a package configuration like a regular python module in OpenERP?

Something like this.

main_module/
     __init__.py
     __openerp__.py
     module.py
     sub/
            __init__.py
            sub_module.py
            sub_module2.py

I understand that in python this would allow me to call from module.submodule import * or via import module.sub_module right? What would be the configuration of the __init__.py files to achieve this? Thanks in advance.

1

Daniel Reis

--Daniel Reis--
3436
| 6 7 9
Lisbon, Portugal
--Daniel Reis--

Author of the "Odoo Development Essentials" book.

Applications Manager at Securitas Portugal

Github: https://github.com/dreispt

Twitter; @reis_pt


Daniel Reis
On 9/11/13, 7:31 PM

Yes, an OpenERP module is basically python code and like a python module. You can see examples of this in the standard modules: notice that many have subdirectories such as wizard or report with an __init__.py and additional python files.

So if wanted to create a model inside a subfolder, how would i need to call it from the __init__.py in the main folder, import submodule or from module.submodule import * (Does this way even works in openerp modules?)

Carlos Llamacho
on 9/12/13, 11:30 AM

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

1 follower(s)

Stats

Asked: 9/11/13, 6:52 PM
Seen: 1578 times
Last updated: 3/16/15, 8:10 AM