SlideShare ist ein Scribd-Unternehmen logo
1 von 32
ODOO (OpenERP)
Creating a MODULE
Tarun Behal
Intro..
 OpenERP use open-object server as ORM (I guess everyone is aware of
ORM)
 To build a module, first decide what you want and create a sample
scheme.
 In this presentation, we’ll create a new module for managing our daily
transactions where we’ll keep a log of where and what money we spent
on a particular day
Daily Transaction manager (a start..)
 Each transaction will have a subject, date, amount we spent and note
section where we can write additional note regarding the transaction.
 We can also categorize transaction based on type. For eg: transport,
household and personal.
 This will help us in categorizing where we are spending more.
Daily Transaction manager - Modelling
 Once our schema is finalized, we can easily extract attribute of each field.
 For eg: Subject of transaction is mandatory, Date must be autofilled for
today’s date.
 So final schema will be as follow:
 Subject – mandatory, text field
 Date – Date field, default with current date
 Notes – text field
 Type – selection field
 Amount – mandatory and float
Daily Transaction Manager - Modelling
 Once our modelling is done, we will create a new module for our Daily
Transaction Manager
 To create a new module, first create a folder named daily_transaction
inside app directory of OpenERP
 Inside that create 2 files named __init__.py and __openerp__.py (we’ll
discuss about the files further in the presentation)
__init__.py
 In this file we’ve to write name of all folder and python files which are to be
compiled for this module.
 If any python file or a directory is not listed in this file, then those files will be
ignored which could result in fatal error
 So in our __init__.py we’ve imported our daily_transaction.py file.
__openerp__.py
__openerp__.py (cont..)
 In this file, we’ll write description of our module and its properties. Lets
discuss each field in this file:
 Name, description, version, author and category are used to describe our
module and its version. So each time we make any changes we’ll increase the
version number.
 Depends : Here we specify if our module depends on other module. For eg: if we
are creating an extension to CRM module we’ll specify ‘depends: [‘crm’]’
 Data: Here we specify all xml files related to our project. We’ll discuss about xml in
later part of presentation
 Installable & Auto-install : I guess the name is enough to explain these properties.
Now lets move to dirtier part of
creating a module
CODING
daily_transaction.py
 I guess I’ve scared you enough (he he he..!!!!). So lets start with show.
 In this file we’ll write our whole code related to our daily transaction, i.e.
Modelling and Logical part.
 As you’re aware now OpenERP uses ORM, so you don’t have to write any
SQL for modelling.
FAQ : Do we’ve to write all our code in this file? (this was asked by one of
trainee while I was explaining about module development)
ANS: NOOO..!!!!!! . Be smarter..!!!! Create another python file, write your code
and just include that in __init__.py
daily_transaction.py (cont..)
daily_transaction.py (cont..)
 As you can see in previous slide we’ve written our code. Lets discuss each
line in detail now. 
 Line #1: from openerp.osv import fields, osv
 The best explanation so far can be found here (I’m lazy programmer so please
go through this and get the knowledge )
 Line #4: class daily_transaction(osv.osv)
 In this we are creating a class for our daily transaction which is inheriting osv class
of OpenERP. This will provide openerp properties of a module to our module, eg:
name, description, columns, defaults etc.
 Line #5, 6 & 9 are properties of our module
 Line #10 to #20 is our modelling of our module we discussed in Daily
Transaction manager - Modelling
daily_transaction.py (cont..)
 Line #10 to #20 will tell you about power of OpenERP ORM.
 This code is enough to create model of our daily_transaction in the
database as well in user interface and guide us which particular field is
mandatory.
 ‘required=True’ is for adding mandatory attribute to our column.
 Other attribute which could be used here are invisible, readonly etc.
 We can use these attributes as dependent on other field values. For eg: we
can make notes field mandatory only if type is household.
 note: fields.text(‘Notes’, type = {‘household’: [{‘required’:True}]}),
Now our modelling part is done, lets move ahead to UI part now.
daily_transaction_view.xml
 I hope everyone may be thinking we need to write HTML, CSS and JS as
well as write actions to do CRUD operation. But with OpenERP forget about
all of this.
 With OpenERP it’ll take minutes to do complete CRUD operation. So lets
begin with it.
 OpenERP uses xml template to render data.
 So first create a file named daily_transaction_view.xml in our module folder.
daily_transaction_view.xml (cont..)
 In this file, we’ll create our module UI
 So in basic UI following things are included:
 Menu
 List View (with OpenERP, we’ll call it Tree view)
 Form View
 Search View
 Other features like datepicker, calendar, sort, group, additional filtering
using AND/OR operation etc. are key features which comes automatically
with OpenERP.
daily_transaction_view.xml - Menu
 To create menu, we first have to understand our requirements.
 We want our module to have a separate Menu header like any other Sales,
Purchase module
 So out structure will be as follows:
 Daily Transaction (this will be our main menu item for our Module)
 Daily Transaction (this will be our sub menu)
 Daily Transaction (this will list our records and we’ll do CRUD operation here, i.e. action menu)
 So as you can see we’ve to create 3 menus.
daily_transaction_view.xml – Menu
(cont..)
 <!-- Main Menu Related Info -->
 <menuitem name="Daily Transaction" id="base.daily_transaction_root" sequence="60"/>
 <!-- Sub Menu Related Info -->
 <menuitem id="menu_daily_transaction_root" name="Daily Transaction"
parent="base.daily_transaction_root" sequence="1" />
 <!– Action Menu Related Info -->
 <menuitem action="action_daily_transaction" id="menu_action_daily_transaction"
parent="menu_daily_transaction_root" sequence="20"/>
So as you can see in our main menu, we have no parent specified. So this will create our parent
menu. In sub menu, we’ve parent, so it’ll create child of that parent menu. And in third we can see
we’ve associated an action to that, so it’ll call that action (we’ll discuss that later in the ppt)
daily_transaction_view.xml – Tree
 To create list/ tree /table, we first have to understand our requirements.
 We want our tree view which will show, subject of our transaction, date of
transaction, type and amount.
 So out structure will be as follows:
 Daily Transaction (this will be our title of List/tree view)
 Subject Date Type Amount
 <Record 1>
 <Record 2>
daily_transaction_view.xml – Tree
(cont..)
This xml will create a record in model ir.ui.view.
<!--Daily Transaction List View-->
<record id="view_daily_transaction_tree" model="ir.ui.view"> <!– here id is the external id for this tree
view which must be unique and will be used for accessing this record -->
<field name="name">daily.transaction.tree</field> <!– this will be our name of record in ir.ui.view -->
<field name="model">daily.transaction</field> <!– this will map out tree view with our daily transaction model -->
<field name="arch" type="xml">
<!-- this will be our title of list/tree view -->
<tree string="Daily Transaction">
<!-- these will automatically map table headers for our list view, so we’ll select out column names of our model here -->
<field name="name"/>
<field name="date"/>
<field name="type"/>
<field name="amount"/>
</tree>
</field>
</record>
daily_transaction_view.xml – Form
We’ll create a simple layout for our form
Subject _______________
Date _________________
Type __<Household><Personal>…..__
Amount _________
Notes
_________________________________
_________________________________
daily_transaction_view.xml – Form
(cont..)
<!--Daily Transaction Form View-->
<record id="view_daily_transaction_form" model="ir.ui.view">
<field name="name">daily.transaction.form.view</field>
<field name="model">daily.transaction</field>
<field name="arch" type="xml">
<!-- this will be our title of list/tree view -->
<form string="Daily Transaction" version="7.0">
<group>
<field name="name"/>
<field name="date"/>
<field name="type"/>
<field name="amount"/>
<field name="note"/>
</group>
</form>
</field>
</record>
CRUD Operation and Controller
 Now I guess you all may be thinking, what the ****. We don’t see how we’ll
click our menu item which will open out list view
 No records were mapped in our list view just like it happens in any other
mvc where we loop over records and render the data
 We didn’t specified which field is mandatory and bla bla..!!!!
 The answer to all such questions is action
 We’ll create another entry in our xml file for action
daily_transaction_view.xml – Action
<record id="action_daily_transaction" model="ir.actions.act_window">
<field name="name">Daily Transaction</field> <!– name of action -->
<field name="res_model">daily.transaction</field> <!– this action will be mapped to model
specified -->
<field name="view_type">form</field>
<field name="view_mode">tree,form</field> <!-- these are type of view our module will show
for our daily transaction mode -->
<field name="search_view_id" eval="False"/> <!– here we specify id of our search view -->
<field name="context">{}</field>
<field name="help">Create new daily transaction.</field> <!– help text for our model -->
</record>
daily_transaction_view.xml – Action
(cont..)
 Line #1 as we see we specified id =“action_daily_transaction”. Now lets
rewind to daily_transaction_view.xml – Menu (cont..) and see for third menu
where we specified action. This is how when we click on that menu, this
action will be called.
 For rest all I’ve mention comment on each line
daily_transaction_view.xml
Now wrap the complete xml code we discussed for menu, list, form and action in
following tags:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
_____________________our code here________________
_____________________our code here________________
</data>
</openerp>
Once done, we’ve to tell OpenERP that this will render view of our module. So we’ll
make entry for the filename in __openerp__.py
Install our module
Once done, now lets install our module and start managing our daily
transaction. So for that following steps need to be followed:
 Step 1: Restart openerp server. (service openerp-server restart)
 Step 2: Login to openerp.
 Step 3: Goto Settings-> Modules -> Update Modules List
Install our module
 Step 4: Click on Update
 Step 5: Once done, remove installed filter and search for our module name
Install our module
 Step 6: Click on Install or you can see module properties by clicking on
module name
Manage our daily transactions
Once installation is done, you can see our module name in menu bar.
Menu #1
Menu #2
Menu #3
Manage our daily transactions -
Create
Click on create and let’s start posting our transactions
Manage our daily transactions – List/
Tree view
“
”
Thank you… 
I would really appreciate your feedback. If you feel that something is missing,
please post your comment. The code is available here. Feel free to email me
at tarunbehal@hotmail.com

Weitere ähnliche Inhalte

Was ist angesagt?

INF107 - Integrating HCL Domino and Microsoft 365
INF107 - Integrating HCL Domino and Microsoft 365INF107 - Integrating HCL Domino and Microsoft 365
INF107 - Integrating HCL Domino and Microsoft 365Dylan Redfield
 
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) HackableCollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) HackableDarren Duke
 
Domino policies deep dive
Domino policies deep diveDomino policies deep dive
Domino policies deep diveMartijn de Jong
 
Step By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business IntelligenceStep By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business IntelligenceOsama Mustafa
 
DominoMigrationProposal
DominoMigrationProposalDominoMigrationProposal
DominoMigrationProposalLynn Levash
 
Lesson 3 - Understanding Native Applications, Tools, Mobility, and Remote Man...
Lesson 3 - Understanding Native Applications, Tools, Mobility, and Remote Man...Lesson 3 - Understanding Native Applications, Tools, Mobility, and Remote Man...
Lesson 3 - Understanding Native Applications, Tools, Mobility, and Remote Man...Gene Carboni
 
Entornos apex onpremise
Entornos apex onpremiseEntornos apex onpremise
Entornos apex onpremiseDaniel Bozzolo
 
The Ultimate Administrator’s Guide to HCL Nomad Web
The Ultimate Administrator’s Guide to HCL Nomad WebThe Ultimate Administrator’s Guide to HCL Nomad Web
The Ultimate Administrator’s Guide to HCL Nomad Webpanagenda
 
Engage2022 - Domino Admin Tips
Engage2022 - Domino Admin TipsEngage2022 - Domino Admin Tips
Engage2022 - Domino Admin TipsGabriella Davis
 
Domino Server Health - Monitoring and Managing
 Domino Server Health - Monitoring and Managing Domino Server Health - Monitoring and Managing
Domino Server Health - Monitoring and ManagingGabriella Davis
 
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...Christoph Adler
 
View Inheritance in Odoo 15
View Inheritance in Odoo 15View Inheritance in Odoo 15
View Inheritance in Odoo 15Celine George
 
Tutorial: Develop an App with the Odoo Framework
Tutorial: Develop an App with the Odoo FrameworkTutorial: Develop an App with the Odoo Framework
Tutorial: Develop an App with the Odoo FrameworkOdoo
 
dominocamp2022.t1s1.dde.pptx
dominocamp2022.t1s1.dde.pptxdominocamp2022.t1s1.dde.pptx
dominocamp2022.t1s1.dde.pptxUlrich Krause
 
Installing & Configuring IBM Domino 9 on CentOS
Installing & Configuring IBM Domino 9 on CentOSInstalling & Configuring IBM Domino 9 on CentOS
Installing & Configuring IBM Domino 9 on CentOSDevin Olson
 
Oracle EBS R12.2 - Deployment and System Administration
Oracle EBS R12.2 - Deployment and System AdministrationOracle EBS R12.2 - Deployment and System Administration
Oracle EBS R12.2 - Deployment and System AdministrationMozammel Hoque
 
OBIEE 11g installation steps
OBIEE 11g installation stepsOBIEE 11g installation steps
OBIEE 11g installation stepsDharmaraj Borse
 

Was ist angesagt? (20)

INF107 - Integrating HCL Domino and Microsoft 365
INF107 - Integrating HCL Domino and Microsoft 365INF107 - Integrating HCL Domino and Microsoft 365
INF107 - Integrating HCL Domino and Microsoft 365
 
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) HackableCollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
 
Domino policies deep dive
Domino policies deep diveDomino policies deep dive
Domino policies deep dive
 
Step By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business IntelligenceStep By Step to Install Oracle Business Intelligence
Step By Step to Install Oracle Business Intelligence
 
Command-Line 101
Command-Line 101Command-Line 101
Command-Line 101
 
DominoMigrationProposal
DominoMigrationProposalDominoMigrationProposal
DominoMigrationProposal
 
Lesson 3 - Understanding Native Applications, Tools, Mobility, and Remote Man...
Lesson 3 - Understanding Native Applications, Tools, Mobility, and Remote Man...Lesson 3 - Understanding Native Applications, Tools, Mobility, and Remote Man...
Lesson 3 - Understanding Native Applications, Tools, Mobility, and Remote Man...
 
Entornos apex onpremise
Entornos apex onpremiseEntornos apex onpremise
Entornos apex onpremise
 
The Ultimate Administrator’s Guide to HCL Nomad Web
The Ultimate Administrator’s Guide to HCL Nomad WebThe Ultimate Administrator’s Guide to HCL Nomad Web
The Ultimate Administrator’s Guide to HCL Nomad Web
 
Engage2022 - Domino Admin Tips
Engage2022 - Domino Admin TipsEngage2022 - Domino Admin Tips
Engage2022 - Domino Admin Tips
 
Domino Server Health - Monitoring and Managing
 Domino Server Health - Monitoring and Managing Domino Server Health - Monitoring and Managing
Domino Server Health - Monitoring and Managing
 
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...
 
View Inheritance in Odoo 15
View Inheritance in Odoo 15View Inheritance in Odoo 15
View Inheritance in Odoo 15
 
Modul lengkap
Modul lengkapModul lengkap
Modul lengkap
 
Tutorial: Develop an App with the Odoo Framework
Tutorial: Develop an App with the Odoo FrameworkTutorial: Develop an App with the Odoo Framework
Tutorial: Develop an App with the Odoo Framework
 
dominocamp2022.t1s1.dde.pptx
dominocamp2022.t1s1.dde.pptxdominocamp2022.t1s1.dde.pptx
dominocamp2022.t1s1.dde.pptx
 
Installing & Configuring IBM Domino 9 on CentOS
Installing & Configuring IBM Domino 9 on CentOSInstalling & Configuring IBM Domino 9 on CentOS
Installing & Configuring IBM Domino 9 on CentOS
 
Oracle EBS R12.2 - Deployment and System Administration
Oracle EBS R12.2 - Deployment and System AdministrationOracle EBS R12.2 - Deployment and System Administration
Oracle EBS R12.2 - Deployment and System Administration
 
Linux
LinuxLinux
Linux
 
OBIEE 11g installation steps
OBIEE 11g installation stepsOBIEE 11g installation steps
OBIEE 11g installation steps
 

Andere mochten auch

Timesheet based payroll
Timesheet based payrollTimesheet based payroll
Timesheet based payrollCeline George
 
Development Odoo Basic
Development Odoo BasicDevelopment Odoo Basic
Development Odoo BasicMario IC
 
Xml operations in odoo
Xml operations in odooXml operations in odoo
Xml operations in odooCeline George
 
How to configure PyCharm for Odoo development in Windows?
How to configure PyCharm for Odoo development in Windows?How to configure PyCharm for Odoo development in Windows?
How to configure PyCharm for Odoo development in Windows?Celine George
 
User Manual For Crafito Odoo Theme
User Manual For Crafito Odoo ThemeUser Manual For Crafito Odoo Theme
User Manual For Crafito Odoo ThemeAppJetty
 
Odoo - Backend modules in v8
Odoo - Backend modules in v8Odoo - Backend modules in v8
Odoo - Backend modules in v8Odoo
 

Andere mochten auch (8)

Timesheet based payroll
Timesheet based payrollTimesheet based payroll
Timesheet based payroll
 
Development Odoo Basic
Development Odoo BasicDevelopment Odoo Basic
Development Odoo Basic
 
Xml operations in odoo
Xml operations in odooXml operations in odoo
Xml operations in odoo
 
Widgets in odoo
Widgets in odooWidgets in odoo
Widgets in odoo
 
Odoo Web Services
Odoo Web ServicesOdoo Web Services
Odoo Web Services
 
How to configure PyCharm for Odoo development in Windows?
How to configure PyCharm for Odoo development in Windows?How to configure PyCharm for Odoo development in Windows?
How to configure PyCharm for Odoo development in Windows?
 
User Manual For Crafito Odoo Theme
User Manual For Crafito Odoo ThemeUser Manual For Crafito Odoo Theme
User Manual For Crafito Odoo Theme
 
Odoo - Backend modules in v8
Odoo - Backend modules in v8Odoo - Backend modules in v8
Odoo - Backend modules in v8
 

Ähnlich wie Odoo (OpenERP) - Creating a module

Workflow demo
Workflow demoWorkflow demo
Workflow demoKamal Raj
 
Synapse india reviews on drupal 7 entities (stanford)
Synapse india reviews on drupal 7 entities (stanford)Synapse india reviews on drupal 7 entities (stanford)
Synapse india reviews on drupal 7 entities (stanford)Tarunsingh198
 
Tips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptxTips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptxAgusto Sipahutar
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento Ravi Mehrotra
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development Mage Guru
 
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Chris Laning
 
Connecting your Python App to OpenERP through OOOP
Connecting your Python App to OpenERP through OOOPConnecting your Python App to OpenERP through OOOP
Connecting your Python App to OpenERP through OOOPraimonesteve
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting startedMoniaJ
 
RomaFramework Tutorial Basics
RomaFramework Tutorial BasicsRomaFramework Tutorial Basics
RomaFramework Tutorial BasicsLuca Garulli
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to DjangoJoaquim Rocha
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction PresentationNerd Tzanetopoulos
 
Programming Building Blocks for Admins
Programming Building Blocks for Admins Programming Building Blocks for Admins
Programming Building Blocks for Admins Salesforce Admins
 
Open Source RAD with OpenERP 7.0
Open Source RAD with OpenERP 7.0Open Source RAD with OpenERP 7.0
Open Source RAD with OpenERP 7.0Quang Ngoc
 
Overview of atg framework
Overview of atg frameworkOverview of atg framework
Overview of atg frameworkYousuf Roushan
 
How to Build a Module in Odoo 15 Scaffold Method
How to Build a Module in Odoo 15 Scaffold MethodHow to Build a Module in Odoo 15 Scaffold Method
How to Build a Module in Odoo 15 Scaffold MethodCeline George
 
Oracle EBS Self service from A to Z
Oracle EBS Self service from A to ZOracle EBS Self service from A to Z
Oracle EBS Self service from A to ZFeras Ahmad
 
20 tips and tricks with the Autonomous Database
20 tips and tricks with the Autonomous Database20 tips and tricks with the Autonomous Database
20 tips and tricks with the Autonomous DatabaseSandesh Rao
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsRuth Marvin
 
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...Massimo Cenci
 

Ähnlich wie Odoo (OpenERP) - Creating a module (20)

Workflow demo
Workflow demoWorkflow demo
Workflow demo
 
Synapse india reviews on drupal 7 entities (stanford)
Synapse india reviews on drupal 7 entities (stanford)Synapse india reviews on drupal 7 entities (stanford)
Synapse india reviews on drupal 7 entities (stanford)
 
Tips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptxTips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptx
 
Mangento
MangentoMangento
Mangento
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
 
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.
 
Connecting your Python App to OpenERP through OOOP
Connecting your Python App to OpenERP through OOOPConnecting your Python App to OpenERP through OOOP
Connecting your Python App to OpenERP through OOOP
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting started
 
RomaFramework Tutorial Basics
RomaFramework Tutorial BasicsRomaFramework Tutorial Basics
RomaFramework Tutorial Basics
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
 
Programming Building Blocks for Admins
Programming Building Blocks for Admins Programming Building Blocks for Admins
Programming Building Blocks for Admins
 
Open Source RAD with OpenERP 7.0
Open Source RAD with OpenERP 7.0Open Source RAD with OpenERP 7.0
Open Source RAD with OpenERP 7.0
 
Overview of atg framework
Overview of atg frameworkOverview of atg framework
Overview of atg framework
 
How to Build a Module in Odoo 15 Scaffold Method
How to Build a Module in Odoo 15 Scaffold MethodHow to Build a Module in Odoo 15 Scaffold Method
How to Build a Module in Odoo 15 Scaffold Method
 
Oracle EBS Self service from A to Z
Oracle EBS Self service from A to ZOracle EBS Self service from A to Z
Oracle EBS Self service from A to Z
 
20 tips and tricks with the Autonomous Database
20 tips and tricks with the Autonomous Database20 tips and tricks with the Autonomous Database
20 tips and tricks with the Autonomous Database
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_arguments
 
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
Recipes 10 of Data Warehouse and Business Intelligence - The descriptions man...
 

Kürzlich hochgeladen

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 

Kürzlich hochgeladen (20)

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 

Odoo (OpenERP) - Creating a module

  • 1. ODOO (OpenERP) Creating a MODULE Tarun Behal
  • 2. Intro..  OpenERP use open-object server as ORM (I guess everyone is aware of ORM)  To build a module, first decide what you want and create a sample scheme.  In this presentation, we’ll create a new module for managing our daily transactions where we’ll keep a log of where and what money we spent on a particular day
  • 3. Daily Transaction manager (a start..)  Each transaction will have a subject, date, amount we spent and note section where we can write additional note regarding the transaction.  We can also categorize transaction based on type. For eg: transport, household and personal.  This will help us in categorizing where we are spending more.
  • 4. Daily Transaction manager - Modelling  Once our schema is finalized, we can easily extract attribute of each field.  For eg: Subject of transaction is mandatory, Date must be autofilled for today’s date.  So final schema will be as follow:  Subject – mandatory, text field  Date – Date field, default with current date  Notes – text field  Type – selection field  Amount – mandatory and float
  • 5. Daily Transaction Manager - Modelling  Once our modelling is done, we will create a new module for our Daily Transaction Manager  To create a new module, first create a folder named daily_transaction inside app directory of OpenERP  Inside that create 2 files named __init__.py and __openerp__.py (we’ll discuss about the files further in the presentation)
  • 6. __init__.py  In this file we’ve to write name of all folder and python files which are to be compiled for this module.  If any python file or a directory is not listed in this file, then those files will be ignored which could result in fatal error  So in our __init__.py we’ve imported our daily_transaction.py file.
  • 8. __openerp__.py (cont..)  In this file, we’ll write description of our module and its properties. Lets discuss each field in this file:  Name, description, version, author and category are used to describe our module and its version. So each time we make any changes we’ll increase the version number.  Depends : Here we specify if our module depends on other module. For eg: if we are creating an extension to CRM module we’ll specify ‘depends: [‘crm’]’  Data: Here we specify all xml files related to our project. We’ll discuss about xml in later part of presentation  Installable & Auto-install : I guess the name is enough to explain these properties.
  • 9. Now lets move to dirtier part of creating a module CODING
  • 10. daily_transaction.py  I guess I’ve scared you enough (he he he..!!!!). So lets start with show.  In this file we’ll write our whole code related to our daily transaction, i.e. Modelling and Logical part.  As you’re aware now OpenERP uses ORM, so you don’t have to write any SQL for modelling. FAQ : Do we’ve to write all our code in this file? (this was asked by one of trainee while I was explaining about module development) ANS: NOOO..!!!!!! . Be smarter..!!!! Create another python file, write your code and just include that in __init__.py
  • 12. daily_transaction.py (cont..)  As you can see in previous slide we’ve written our code. Lets discuss each line in detail now.   Line #1: from openerp.osv import fields, osv  The best explanation so far can be found here (I’m lazy programmer so please go through this and get the knowledge )  Line #4: class daily_transaction(osv.osv)  In this we are creating a class for our daily transaction which is inheriting osv class of OpenERP. This will provide openerp properties of a module to our module, eg: name, description, columns, defaults etc.  Line #5, 6 & 9 are properties of our module  Line #10 to #20 is our modelling of our module we discussed in Daily Transaction manager - Modelling
  • 13. daily_transaction.py (cont..)  Line #10 to #20 will tell you about power of OpenERP ORM.  This code is enough to create model of our daily_transaction in the database as well in user interface and guide us which particular field is mandatory.  ‘required=True’ is for adding mandatory attribute to our column.  Other attribute which could be used here are invisible, readonly etc.  We can use these attributes as dependent on other field values. For eg: we can make notes field mandatory only if type is household.  note: fields.text(‘Notes’, type = {‘household’: [{‘required’:True}]}), Now our modelling part is done, lets move ahead to UI part now.
  • 14. daily_transaction_view.xml  I hope everyone may be thinking we need to write HTML, CSS and JS as well as write actions to do CRUD operation. But with OpenERP forget about all of this.  With OpenERP it’ll take minutes to do complete CRUD operation. So lets begin with it.  OpenERP uses xml template to render data.  So first create a file named daily_transaction_view.xml in our module folder.
  • 15. daily_transaction_view.xml (cont..)  In this file, we’ll create our module UI  So in basic UI following things are included:  Menu  List View (with OpenERP, we’ll call it Tree view)  Form View  Search View  Other features like datepicker, calendar, sort, group, additional filtering using AND/OR operation etc. are key features which comes automatically with OpenERP.
  • 16. daily_transaction_view.xml - Menu  To create menu, we first have to understand our requirements.  We want our module to have a separate Menu header like any other Sales, Purchase module  So out structure will be as follows:  Daily Transaction (this will be our main menu item for our Module)  Daily Transaction (this will be our sub menu)  Daily Transaction (this will list our records and we’ll do CRUD operation here, i.e. action menu)  So as you can see we’ve to create 3 menus.
  • 17. daily_transaction_view.xml – Menu (cont..)  <!-- Main Menu Related Info -->  <menuitem name="Daily Transaction" id="base.daily_transaction_root" sequence="60"/>  <!-- Sub Menu Related Info -->  <menuitem id="menu_daily_transaction_root" name="Daily Transaction" parent="base.daily_transaction_root" sequence="1" />  <!– Action Menu Related Info -->  <menuitem action="action_daily_transaction" id="menu_action_daily_transaction" parent="menu_daily_transaction_root" sequence="20"/> So as you can see in our main menu, we have no parent specified. So this will create our parent menu. In sub menu, we’ve parent, so it’ll create child of that parent menu. And in third we can see we’ve associated an action to that, so it’ll call that action (we’ll discuss that later in the ppt)
  • 18. daily_transaction_view.xml – Tree  To create list/ tree /table, we first have to understand our requirements.  We want our tree view which will show, subject of our transaction, date of transaction, type and amount.  So out structure will be as follows:  Daily Transaction (this will be our title of List/tree view)  Subject Date Type Amount  <Record 1>  <Record 2>
  • 19. daily_transaction_view.xml – Tree (cont..) This xml will create a record in model ir.ui.view. <!--Daily Transaction List View--> <record id="view_daily_transaction_tree" model="ir.ui.view"> <!– here id is the external id for this tree view which must be unique and will be used for accessing this record --> <field name="name">daily.transaction.tree</field> <!– this will be our name of record in ir.ui.view --> <field name="model">daily.transaction</field> <!– this will map out tree view with our daily transaction model --> <field name="arch" type="xml"> <!-- this will be our title of list/tree view --> <tree string="Daily Transaction"> <!-- these will automatically map table headers for our list view, so we’ll select out column names of our model here --> <field name="name"/> <field name="date"/> <field name="type"/> <field name="amount"/> </tree> </field> </record>
  • 20. daily_transaction_view.xml – Form We’ll create a simple layout for our form Subject _______________ Date _________________ Type __<Household><Personal>…..__ Amount _________ Notes _________________________________ _________________________________
  • 21. daily_transaction_view.xml – Form (cont..) <!--Daily Transaction Form View--> <record id="view_daily_transaction_form" model="ir.ui.view"> <field name="name">daily.transaction.form.view</field> <field name="model">daily.transaction</field> <field name="arch" type="xml"> <!-- this will be our title of list/tree view --> <form string="Daily Transaction" version="7.0"> <group> <field name="name"/> <field name="date"/> <field name="type"/> <field name="amount"/> <field name="note"/> </group> </form> </field> </record>
  • 22. CRUD Operation and Controller  Now I guess you all may be thinking, what the ****. We don’t see how we’ll click our menu item which will open out list view  No records were mapped in our list view just like it happens in any other mvc where we loop over records and render the data  We didn’t specified which field is mandatory and bla bla..!!!!  The answer to all such questions is action  We’ll create another entry in our xml file for action
  • 23. daily_transaction_view.xml – Action <record id="action_daily_transaction" model="ir.actions.act_window"> <field name="name">Daily Transaction</field> <!– name of action --> <field name="res_model">daily.transaction</field> <!– this action will be mapped to model specified --> <field name="view_type">form</field> <field name="view_mode">tree,form</field> <!-- these are type of view our module will show for our daily transaction mode --> <field name="search_view_id" eval="False"/> <!– here we specify id of our search view --> <field name="context">{}</field> <field name="help">Create new daily transaction.</field> <!– help text for our model --> </record>
  • 24. daily_transaction_view.xml – Action (cont..)  Line #1 as we see we specified id =“action_daily_transaction”. Now lets rewind to daily_transaction_view.xml – Menu (cont..) and see for third menu where we specified action. This is how when we click on that menu, this action will be called.  For rest all I’ve mention comment on each line
  • 25. daily_transaction_view.xml Now wrap the complete xml code we discussed for menu, list, form and action in following tags: <?xml version="1.0" encoding="utf-8"?> <openerp> <data> _____________________our code here________________ _____________________our code here________________ </data> </openerp> Once done, we’ve to tell OpenERP that this will render view of our module. So we’ll make entry for the filename in __openerp__.py
  • 26. Install our module Once done, now lets install our module and start managing our daily transaction. So for that following steps need to be followed:  Step 1: Restart openerp server. (service openerp-server restart)  Step 2: Login to openerp.  Step 3: Goto Settings-> Modules -> Update Modules List
  • 27. Install our module  Step 4: Click on Update  Step 5: Once done, remove installed filter and search for our module name
  • 28. Install our module  Step 6: Click on Install or you can see module properties by clicking on module name
  • 29. Manage our daily transactions Once installation is done, you can see our module name in menu bar. Menu #1 Menu #2 Menu #3
  • 30. Manage our daily transactions - Create Click on create and let’s start posting our transactions
  • 31. Manage our daily transactions – List/ Tree view
  • 32. “ ” Thank you…  I would really appreciate your feedback. If you feel that something is missing, please post your comment. The code is available here. Feel free to email me at tarunbehal@hotmail.com