26 Feb 2017

Creating custom module in Odoo 10

Odoo is an open source ERP platform which is powerful, and easy to customize. In this tutorial, we will learn how to create your own module from scratch in Odoo 10.


Step 1: Download Odoo 10 from GitHub repository

                   Click here to clone odoo


Step 2: Configure PyDev in your Eclipse IDE

Following are the steps:
  • Open your Eclipse editor, and in the window's title bar, go to Help > Install New Software...
  • Add PyDev repository typing the following link: http://pydev.org
  • Then follow the steps as mentioned in the wizard and complete the PyDev configuration


Step 3: Create a new PyDev project in Eclipse IDE

Follow these steps to create a new PyDev project:

Step 3.1: In Eclipse title bar, go to File > New > PyDev Project

Step 3.2: After creating a project, go to File > Import... and import the downloaded Odoo resources in your project

Step 3.3: Your new PyDev project should look as shown below:




Step 4: Download the below listed additional packages on your Ubuntu 16.04 from your terminal

sudo apt-get install python-dateutil python-feedparser python-gdata python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil wget python-unittest2 python-mock python-jinja2 python-dev libpq-dev poppler-utils python-pdftools antiword python-setuptools python-pybabel python-decorator python-requests python-pyPdf python-passlib node-less  


Step 5: Install PostgreSQL database on your Ubuntu 16.04 and create the role of the user with the name same as your computer system's user name

linuxbeginner@linuxbeginner-Inspiron-5520:~$ sudo apt-get install postgresql  

linuxbeginner@linuxbeginner-Inspiron-5520:~$ sudo su postgres  

postgres@linuxbeginner-Inspiron-5520:/home/linuxbeginner$ createuser -d linuxbeginner  


Step 6: Running Odoo 10 for the first time on localhost

Step 6.1: Right click after selecting odoo-bin, go to Run As > Run Configurations... and in the Arguments tab, give -s which automatically generates the config file in your computer's home directory


Step 6.2: Click Apply button and then Run button

Step 6.3: Type the following URL in web browser: http://localhost:8069/web

Here 8069 is the default port where the odoo services run, you can manually change the port in the automatically generated config file named .odoorc in your home directory.

Step 6.4: Create a new database as shown below where you will be able to install your custom odoo module



The above steps were the basic How Tos of running Odoo 10 on your computer system. Now the steps to create your own Odoo module begins.


Step 7: Create your customized addons directory in odoo_v10 project and add its absolute path in .odoorc config file in home directory under addons_path which are comma(,) separated

My customized addons folder's absolute path is as follows:
 /home/linuxbeginner/Documents/eclipse/odoo_v10/test-addons  


Step 8: Create your customized module in your addons folder with __manifest__.py and __init__.py file into it

You can get the brief idea of modules, manifest files, and Python packages by viewing the source code of existing odoo modules.
__manifest__.py file source code:

 {  
   'name' : 'My First Odoo Module',  
   'version' : '1.0',  
   'summary': 'Understanding Odoo Development',  
   'sequence': 99,  
   'description': """  
 About  
 ====================  
 The following module is created for blog post.  
   """,  
   'category': 'Tutorial',  
   'website': 'techcontributors.blogspot.com',  
   'depends' : ['base'],  
   'installable': True,  
   'application': True,  
   'auto_install': False,  
 }  

Manifest file is a Python dictionary which has key-value pairs holding the information about the module, its dependencies, as well as its resources. Looking at the manifest files of in-built Odoo modules, you will get an in-depth exposure to manifest files.


Step 9: Go to web browser and click 'Activate the developer mode' available in Settings tab and click 'Update Apps List' in Apps

You can see your module in Odoo after searching it with the name given. You can see the information being displayed is same as the one you gave in your manifest file. Now your custom Odoo module is ready for install.

1 comment:

  1. Really good work there. Informative and helpful. Appreciate it. But might be looking for Odoo Custom Module Development in Pennsylvania

    ReplyDelete