Skip to Content
Menu
This question has been flagged
4 Replies
5594 Views

Hello,

Do you know some tutorials to create (step by step) a new module in Odoo9 ?

Thank you.

Avatar
Discard
Best Answer

If you're willing to spend a little money, the Odoo Development Cookbook is a great, new resource. Udemy has a decent video tutorial as well, but it's a bit pricier.

https://www.packtpub.com/big-data-and-business-intelligence/odoo-development-cookbook

https://www.udemy.com/odoo-technical/

Avatar
Discard
Best Answer

Hi Lince,

You can find an official tutorial (written by Odoo) here: https://www.odoo.com/documentation/9.0/howtos/backend.html
It explains the basic concepts pretty good. For further and more advanced things there are usually some tutorials on the internet too.

Yenthe


Avatar
Discard
Best Answer

See the  simple example structure

 ◲ custom_module
|___ ◲ models
| |___◫ __init__.py
| |___◫ custom_models.py
|
|___ ◲ views
 |    |___◫ custom_view.xml
|
 |___ ◫ __init__.py
 |___ ◫ __openerp__.py

You can watch this on YouTube:  Create and install new custom module in odoo 10 

                        Note : __openerp__.py for odoo 9 and  __manifest__.py for odoo 10

Following are contents of each files.


custom_module/__init__.py

import models

custom_module/__openerp__.py

{ 'name': 'Custom Module', 
'description': 'Description about your module',
'depends': ['base'],
'data': ['views/custom_view.xml'],
}

custom_module/models/__init__.py

import custom_models

custom_module/models/custom_models.py

from odoo import models, fields, api 

class CustomModel(models.Model):
_name = 'custom.model'

name = fields.Char(string='Name')
custom_module/views/custom_view.xml
 <!--Create Top Menu-->
<menuitem name="Top Menu" id="custom_top_menu"/>

<!--Create Sub Child Menu-->
<menuitem name="Sub Child Menu" id="custom_sub_menu" parent="custom_top_menu"/>

<!--Tree view-->
<record id="tree_custom_model" model="ir.ui.view">
  <field name="name">custom.model.tree</field>
<field name="model">custom.model</field>
<field name="arch" type="xml">
<tree>
 <field name="name"/>
 </tree>
</field>
</record>
<!--Form View-->
<record id="form_custom_model" model="ir.ui.view">
<field name="name">custom.model.form</field>
 <field name="model">custom.model</field>
 <field name="arch" type="xml">
<form>
 <sheet>
<group>
 <group>
<field name="name" required="1"/>
</group>
<group/>
 </group>
</sheet>
</form>
</field>
 </record>
<!--Define custom_action-->
<record id="custom_action" model="ir.actions.act_window">
<field name="name">Child Menu</field>
  <field name="res_model">custom.model</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
 <p class="oe_view_nocontent_create">
Click here to create new item !
</p>
</field>
</record>
<!--Create child menu /Action menu-->
<menuitem name="Child Menu" id="custom_child_menu" parent="custom_sub_menu"
action="custom_action"/>
Avatar
Discard
Best Answer

I recomend download some module examples from gitHub and adapt the code.

Avatar
Discard