SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Backend Modules in V8
Raphael Collet (rco@odoo.com)
Agenda
Architecture of Odoo
Module Open Academy
·
·
Architecture of Odoo
Architecture of Odoo
Three-tier client/server/database
Web client in Javascript
Server and backend modules in Python
MVC framework
·
·
·
·
Module Open Academy
The Module
Manage courses, sessions, and subscriptions
Learn
Structure of a module
Definition of data models
Definition of views and menus
·
·
·
·
·
Structure of a Module
An Odoo module is
a python module (data models), with
a manifest file,
XML and CSV data files (base data, views, menus),
frontend resources (Javascript, CSS).
·
·
·
·
The Open Academy Module
The manifest file __odoo__.py:
{{
'name':: 'Open Academy',,
'version':: '1.0',,
'category':: 'Tools',,
'summary':: 'Courses, Sessions, Subscriptions',,
'description':: "...",,
'depends' :: [['base'],],
'data' :: [['view/menu.xml'],],
'images':: [],[],
'demo':: [],[],
'application':: True,,
}}
The Course Model
A model and its fields are defined in a Python class:
fromfrom odoo importimport Model,, fields
classclass Course((Model):):
_name == 'openacademy.course'
name == fields..Char((string=='Title',, required==True))
description == fields..Text()()
The Menu as XML data
<?xml version="1.0" encoding="UTF-8"?>
<openerp><openerp>
<data><data>
<menuitem<menuitem name="Open Academy" id="menu_root" sequence="110"/>/>
<menuitem<menuitem name="General" id="menu_general" parent="menu_root"/>/>
<record<record model="ir.actions.act_window" id="action_courses">>
<field<field name="name">>Courses</field></field>
<field<field name="res_model">>openacademy.course</field></field>
<field<field name="view_mode">>tree,form</field></field>
</record></record>
<menuitem<menuitem name="Courses" id="menu_courses" parent="menu_general"
sequence="1" action="action_courses"/>/>
</data></data>
</openerp></openerp>
Let's add a Form View
<record<record model="ir.ui.view" id="course_form">>
<field<field name="name">>course form view</field></field>
<field<field name="model">>openacademy.course</field></field>
<field<field name="arch" type="xml">>
<form<form string="Course" version="7.0">>
<sheet><sheet>
<h1><h1>
<field<field name="name" placeholder="Course Title"/>/>
</h1></h1>
<notebook><notebook>
<page<page string="Description">>
<field<field name="description"/>/>
</page></page>
</notebook></notebook>
</sheet></sheet>
</form></form>
</field></field>
</record></record>
The Session Model
classclass Session((Model):):
_name == 'openacademy.session'
name == fields..Char((required==True))
start_date == fields..Date()()
duration == fields..Integer((help=="Duration in days"))
seats == fields..Integer((string=="Number of Seats"))
Relational Fields
Let us link sessions to courses and instructors:
classclass Session((Model):):
_name == 'openacademy.session'
......
course == fields..Many2one(('openacademy.course',, required==True))
instructor == fields..Many2one(('res.partner'))
Relational Fields
Let us back-link courses and sessions:
classclass Course((Model):):
_name == 'openacademy.course'
......
responsible == fields..Many2one(('res.users'))
sessions == fields..One2many(('openacademy.session',, 'course'))
Relational Fields
Let us link sessions to partners for attendee subscription:
classclass Session((Model):):
_name == 'openacademy.session'
......
attendees == fields..Many2many(('res.partner'))
Computed Fields
The value of those fields is computed:
classclass Session((Model):):
_name == 'openacademy.session'
......
taken_seats == fields..Float((compute=='_compute_taken_seats'))
@api.one@api.one
@api.depends@api.depends(('attendees',, 'seats'))
defdef _compute_taken_seats((self):):
ifif self..seats::
self..taken_seats == 100.0100.0 ** len((self..attendees)) // self..seats
elseelse::
self..taken_seats == 0.00.0
About self
Model instances are recordsetsrecordsets.
A recordset is an hybrid concept:
collection of records
record
forfor session inin self::
printprint session..name
printprint session..course..name
assertassert self..name ==== self[[00]]..name
·
·
Feedback with "Onchange"
Methods
Modify form values when some field is filled in:
classclass Session((Model):):
_name == 'openacademy.session'
......
@api.onchange@api.onchange(('course'))
defdef _onchange_course((self):):
ifif notnot self..name::
self..name == self..course..name
Default Values
Specify the initial value to use in a form:
classclass Session((Model):):
_name == 'openacademy.session'
......
active == fields..Boolean((default==True))
start_date == fields..Date((default==fields..Date..today))
......
Model Constraints
Prevent bad data:
fromfrom odoo.exceptions importimport WarningWarning
classclass Session((Model):):
_name == 'openacademy.session'
......
@api.one@api.one
@api.constrains@api.constrains(('instructor',, 'attendees'))
defdef _check_instructor((self):):
ifif self..instructor inin self..attendees::
raiseraise WarningWarning(("Instructor of session '%s' "
"cannot attend its own session" %% self..name))
More Stuff
Extend existing models
Many view types
Workflows
Reports
Security
Translations
·
·
·
·
·
·
Backend Modules in V8
Conclusion
Modules have a simple structure
Model definition intuitive and efficient
uses Python standards (decorators, descriptors)
recordsets provide support for "batch" processing
many model hooks (default values, constraints,
computed fields)
·
·
·
·
·

Contenu connexe

Tendances

How to develop automated tests
How to develop automated testsHow to develop automated tests
How to develop automated testsOdoo
 
New Framework - ORM
New Framework - ORMNew Framework - ORM
New Framework - ORMOdoo
 
Odoo's Test Framework - Learn Best Practices
Odoo's Test Framework - Learn Best PracticesOdoo's Test Framework - Learn Best Practices
Odoo's Test Framework - Learn Best PracticesOdoo
 
Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...Odoo
 
External dependencies ,pre init hook &amp; post init hook in odoo
External dependencies ,pre init hook &amp; post init hook in odooExternal dependencies ,pre init hook &amp; post init hook in odoo
External dependencies ,pre init hook &amp; post init hook in odooCeline George
 
Empower your App by Inheriting from Odoo Mixins
Empower your App by Inheriting from Odoo MixinsEmpower your App by Inheriting from Odoo Mixins
Empower your App by Inheriting from Odoo MixinsOdoo
 
How to Develop your own in App-Purchase Service in Odoo
How to Develop your own in App-Purchase Service in OdooHow to Develop your own in App-Purchase Service in Odoo
How to Develop your own in App-Purchase Service in OdooOdoo
 
An in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORMAn in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORMOdoo
 
Actions and menus in odoo 16
Actions and menus in odoo 16Actions and menus in odoo 16
Actions and menus in odoo 16Celine George
 
Impact of the New ORM on Your Modules
Impact of the New ORM on Your ModulesImpact of the New ORM on Your Modules
Impact of the New ORM on Your ModulesOdoo
 
Odoo ORM Methods | Object Relational Mapping in Odoo15
Odoo ORM Methods | Object Relational Mapping in Odoo15 Odoo ORM Methods | Object Relational Mapping in Odoo15
Odoo ORM Methods | Object Relational Mapping in Odoo15 Celine George
 
Odoo Online platform: architecture and challenges
Odoo Online platform: architecture and challengesOdoo Online platform: architecture and challenges
Odoo Online platform: architecture and challengesOdoo
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesOdoo
 
What is Delegation Inheritance in Odoo 15
What is Delegation Inheritance in Odoo 15What is Delegation Inheritance in Odoo 15
What is Delegation Inheritance in Odoo 15Celine George
 
How to Import data into OpenERP V7
How to Import data into OpenERP V7How to Import data into OpenERP V7
How to Import data into OpenERP V7Audaxis
 
Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)sroo galal
 
Docx Report Module
Docx Report ModuleDocx Report Module
Docx Report ModuleOdoo
 
Empower your App by Inheriting from Odoo Mixins
Empower your App by Inheriting from Odoo MixinsEmpower your App by Inheriting from Odoo Mixins
Empower your App by Inheriting from Odoo MixinsOdoo
 
How to Create a l10n Payroll Structure
How to Create a l10n Payroll StructureHow to Create a l10n Payroll Structure
How to Create a l10n Payroll StructureOdoo
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC FrameworkBala Kumar
 

Tendances (20)

How to develop automated tests
How to develop automated testsHow to develop automated tests
How to develop automated tests
 
New Framework - ORM
New Framework - ORMNew Framework - ORM
New Framework - ORM
 
Odoo's Test Framework - Learn Best Practices
Odoo's Test Framework - Learn Best PracticesOdoo's Test Framework - Learn Best Practices
Odoo's Test Framework - Learn Best Practices
 
Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...
 
External dependencies ,pre init hook &amp; post init hook in odoo
External dependencies ,pre init hook &amp; post init hook in odooExternal dependencies ,pre init hook &amp; post init hook in odoo
External dependencies ,pre init hook &amp; post init hook in odoo
 
Empower your App by Inheriting from Odoo Mixins
Empower your App by Inheriting from Odoo MixinsEmpower your App by Inheriting from Odoo Mixins
Empower your App by Inheriting from Odoo Mixins
 
How to Develop your own in App-Purchase Service in Odoo
How to Develop your own in App-Purchase Service in OdooHow to Develop your own in App-Purchase Service in Odoo
How to Develop your own in App-Purchase Service in Odoo
 
An in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORMAn in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORM
 
Actions and menus in odoo 16
Actions and menus in odoo 16Actions and menus in odoo 16
Actions and menus in odoo 16
 
Impact of the New ORM on Your Modules
Impact of the New ORM on Your ModulesImpact of the New ORM on Your Modules
Impact of the New ORM on Your Modules
 
Odoo ORM Methods | Object Relational Mapping in Odoo15
Odoo ORM Methods | Object Relational Mapping in Odoo15 Odoo ORM Methods | Object Relational Mapping in Odoo15
Odoo ORM Methods | Object Relational Mapping in Odoo15
 
Odoo Online platform: architecture and challenges
Odoo Online platform: architecture and challengesOdoo Online platform: architecture and challenges
Odoo Online platform: architecture and challenges
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance Issues
 
What is Delegation Inheritance in Odoo 15
What is Delegation Inheritance in Odoo 15What is Delegation Inheritance in Odoo 15
What is Delegation Inheritance in Odoo 15
 
How to Import data into OpenERP V7
How to Import data into OpenERP V7How to Import data into OpenERP V7
How to Import data into OpenERP V7
 
Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)
 
Docx Report Module
Docx Report ModuleDocx Report Module
Docx Report Module
 
Empower your App by Inheriting from Odoo Mixins
Empower your App by Inheriting from Odoo MixinsEmpower your App by Inheriting from Odoo Mixins
Empower your App by Inheriting from Odoo Mixins
 
How to Create a l10n Payroll Structure
How to Create a l10n Payroll StructureHow to Create a l10n Payroll Structure
How to Create a l10n Payroll Structure
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC Framework
 

En vedette

Odoo 2016 - Retrospective
Odoo 2016 - RetrospectiveOdoo 2016 - Retrospective
Odoo 2016 - RetrospectiveOdoo
 
Odoo (OpenERP) - Creating a module
Odoo (OpenERP) - Creating a moduleOdoo (OpenERP) - Creating a module
Odoo (OpenERP) - Creating a moduleTarun Behal
 
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
 
Timesheet based payroll
Timesheet based payrollTimesheet based payroll
Timesheet based payrollCeline George
 
Xml operations in odoo
Xml operations in odooXml operations in odoo
Xml operations in odooCeline George
 
Development Odoo Basic
Development Odoo BasicDevelopment Odoo Basic
Development Odoo BasicMario IC
 
User Manual For Crafito Odoo Theme
User Manual For Crafito Odoo ThemeUser Manual For Crafito Odoo Theme
User Manual For Crafito Odoo ThemeAppJetty
 
Odoo - Create themes for website
Odoo - Create themes for websiteOdoo - Create themes for website
Odoo - Create themes for websiteOdoo
 

En vedette (10)

Odoo 2016 - Retrospective
Odoo 2016 - RetrospectiveOdoo 2016 - Retrospective
Odoo 2016 - Retrospective
 
Odoo (OpenERP) - Creating a module
Odoo (OpenERP) - Creating a moduleOdoo (OpenERP) - Creating a module
Odoo (OpenERP) - Creating a module
 
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?
 
Widgets in odoo
Widgets in odooWidgets in odoo
Widgets in odoo
 
Timesheet based payroll
Timesheet based payrollTimesheet based payroll
Timesheet based payroll
 
Xml operations in odoo
Xml operations in odooXml operations in odoo
Xml operations in odoo
 
Development Odoo Basic
Development Odoo BasicDevelopment Odoo Basic
Development Odoo Basic
 
User Manual For Crafito Odoo Theme
User Manual For Crafito Odoo ThemeUser Manual For Crafito Odoo Theme
User Manual For Crafito Odoo Theme
 
Odoo - Create themes for website
Odoo - Create themes for websiteOdoo - Create themes for website
Odoo - Create themes for website
 

Similaire à Odoo - Backend modules in v8

MOOC: Python & Web as Architecture
MOOC: Python & Web as ArchitectureMOOC: Python & Web as Architecture
MOOC: Python & Web as ArchitectureRizky Ariestiyansyah
 
Tutorial mvc (pelajari ini jika ingin tahu mvc) keren
Tutorial mvc (pelajari ini jika ingin tahu mvc) kerenTutorial mvc (pelajari ini jika ingin tahu mvc) keren
Tutorial mvc (pelajari ini jika ingin tahu mvc) kerenSony Suci
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009hugowetterberg
 
Azure machine learning service
Azure machine learning serviceAzure machine learning service
Azure machine learning serviceRuth Yakubu
 
Template rendering in rails
Template rendering in rails Template rendering in rails
Template rendering in rails Hung Wu Lo
 
Develop an App with the Odoo Framework
Develop an App with the Odoo FrameworkDevelop an App with the Odoo Framework
Develop an App with the Odoo FrameworkOdoo
 
Microservices Primer for Monolithic Devs
Microservices Primer for Monolithic DevsMicroservices Primer for Monolithic Devs
Microservices Primer for Monolithic DevsLloyd Faulkner
 
Utilisation de MLflow pour le cycle de vie des projet Machine learning
Utilisation de MLflow pour le cycle de vie des projet Machine learningUtilisation de MLflow pour le cycle de vie des projet Machine learning
Utilisation de MLflow pour le cycle de vie des projet Machine learningParis Data Engineers !
 
Building and Running Your App in the Cloud
Building and Running Your App in the CloudBuilding and Running Your App in the Cloud
Building and Running Your App in the CloudBrandon Minnick, MBA
 
Zotonic tutorial EUC 2013
Zotonic tutorial EUC 2013Zotonic tutorial EUC 2013
Zotonic tutorial EUC 2013Arjan
 
Django Admin: Widgetry & Witchery
Django Admin: Widgetry & WitcheryDjango Admin: Widgetry & Witchery
Django Admin: Widgetry & WitcheryPamela Fox
 
Introduction to Backbone.js for Rails developers
Introduction to Backbone.js for Rails developersIntroduction to Backbone.js for Rails developers
Introduction to Backbone.js for Rails developersAoteaStudios
 
Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)
Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)
Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)camunda services GmbH
 
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...Puppet
 
Laravel 8 export data as excel file with example
Laravel 8 export data as excel file with exampleLaravel 8 export data as excel file with example
Laravel 8 export data as excel file with exampleKaty Slemon
 

Similaire à Odoo - Backend modules in v8 (20)

MOOC: Python & Web as Architecture
MOOC: Python & Web as ArchitectureMOOC: Python & Web as Architecture
MOOC: Python & Web as Architecture
 
Tutorial mvc (pelajari ini jika ingin tahu mvc) keren
Tutorial mvc (pelajari ini jika ingin tahu mvc) kerenTutorial mvc (pelajari ini jika ingin tahu mvc) keren
Tutorial mvc (pelajari ini jika ingin tahu mvc) keren
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009
 
Neo4j.pptx
Neo4j.pptxNeo4j.pptx
Neo4j.pptx
 
Azure machine learning service
Azure machine learning serviceAzure machine learning service
Azure machine learning service
 
AngularJS and SPA
AngularJS and SPAAngularJS and SPA
AngularJS and SPA
 
Template rendering in rails
Template rendering in rails Template rendering in rails
Template rendering in rails
 
Develop an App with the Odoo Framework
Develop an App with the Odoo FrameworkDevelop an App with the Odoo Framework
Develop an App with the Odoo Framework
 
Microservices Primer for Monolithic Devs
Microservices Primer for Monolithic DevsMicroservices Primer for Monolithic Devs
Microservices Primer for Monolithic Devs
 
Utilisation de MLflow pour le cycle de vie des projet Machine learning
Utilisation de MLflow pour le cycle de vie des projet Machine learningUtilisation de MLflow pour le cycle de vie des projet Machine learning
Utilisation de MLflow pour le cycle de vie des projet Machine learning
 
Building and Running Your App in the Cloud
Building and Running Your App in the CloudBuilding and Running Your App in the Cloud
Building and Running Your App in the Cloud
 
SahanaCamp NYC Day 3: Eden Technical Workshop
SahanaCamp NYC Day 3: Eden Technical WorkshopSahanaCamp NYC Day 3: Eden Technical Workshop
SahanaCamp NYC Day 3: Eden Technical Workshop
 
Zotonic tutorial EUC 2013
Zotonic tutorial EUC 2013Zotonic tutorial EUC 2013
Zotonic tutorial EUC 2013
 
Django Admin: Widgetry & Witchery
Django Admin: Widgetry & WitcheryDjango Admin: Widgetry & Witchery
Django Admin: Widgetry & Witchery
 
Introduction to Backbone.js for Rails developers
Introduction to Backbone.js for Rails developersIntroduction to Backbone.js for Rails developers
Introduction to Backbone.js for Rails developers
 
Oop objects_classes
Oop objects_classesOop objects_classes
Oop objects_classes
 
Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)
Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)
Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)
 
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
 
Laravel 8 export data as excel file with example
Laravel 8 export data as excel file with exampleLaravel 8 export data as excel file with example
Laravel 8 export data as excel file with example
 
Django design-patterns
Django design-patternsDjango design-patterns
Django design-patterns
 

Plus de Odoo

Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!Odoo
 
Odoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-ViewerOdoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-ViewerOdoo
 
Keynote - Vision & Strategy
Keynote - Vision & StrategyKeynote - Vision & Strategy
Keynote - Vision & StrategyOdoo
 
Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14Odoo
 
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting CapabilityExtending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting CapabilityOdoo
 
Managing Multi-channel Selling with Odoo
Managing Multi-channel Selling with OdooManaging Multi-channel Selling with Odoo
Managing Multi-channel Selling with OdooOdoo
 
Product Configurator: Advanced Use Case
Product Configurator: Advanced Use CaseProduct Configurator: Advanced Use Case
Product Configurator: Advanced Use CaseOdoo
 
Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?Odoo
 
Rock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced OperationsRock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced OperationsOdoo
 
Transition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organizationTransition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organizationOdoo
 
Synchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the CrisisSynchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the CrisisOdoo
 
Running a University with Odoo
Running a University with OdooRunning a University with Odoo
Running a University with OdooOdoo
 
Down Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in OdooDown Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in OdooOdoo
 
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach foodOdoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach foodOdoo
 
Migration from Salesforce to Odoo
Migration from Salesforce to OdooMigration from Salesforce to Odoo
Migration from Salesforce to OdooOdoo
 
Preventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine LearningPreventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine LearningOdoo
 
Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification Odoo
 
Instant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping LabelInstant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping LabelOdoo
 
How Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 FoldHow Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 FoldOdoo
 
From Shopify to Odoo
From Shopify to OdooFrom Shopify to Odoo
From Shopify to OdooOdoo
 

Plus de Odoo (20)

Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!
 
Odoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-ViewerOdoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-Viewer
 
Keynote - Vision & Strategy
Keynote - Vision & StrategyKeynote - Vision & Strategy
Keynote - Vision & Strategy
 
Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14
 
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting CapabilityExtending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
 
Managing Multi-channel Selling with Odoo
Managing Multi-channel Selling with OdooManaging Multi-channel Selling with Odoo
Managing Multi-channel Selling with Odoo
 
Product Configurator: Advanced Use Case
Product Configurator: Advanced Use CaseProduct Configurator: Advanced Use Case
Product Configurator: Advanced Use Case
 
Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?
 
Rock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced OperationsRock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced Operations
 
Transition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organizationTransition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organization
 
Synchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the CrisisSynchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the Crisis
 
Running a University with Odoo
Running a University with OdooRunning a University with Odoo
Running a University with Odoo
 
Down Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in OdooDown Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in Odoo
 
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach foodOdoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
 
Migration from Salesforce to Odoo
Migration from Salesforce to OdooMigration from Salesforce to Odoo
Migration from Salesforce to Odoo
 
Preventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine LearningPreventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine Learning
 
Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification
 
Instant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping LabelInstant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping Label
 
How Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 FoldHow Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 Fold
 
From Shopify to Odoo
From Shopify to OdooFrom Shopify to Odoo
From Shopify to Odoo
 

Dernier

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Dernier (20)

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

Odoo - Backend modules in v8

  • 1. Backend Modules in V8 Raphael Collet (rco@odoo.com)
  • 4. Architecture of Odoo Three-tier client/server/database Web client in Javascript Server and backend modules in Python MVC framework · · · ·
  • 6. The Module Manage courses, sessions, and subscriptions Learn Structure of a module Definition of data models Definition of views and menus · · · · ·
  • 7. Structure of a Module An Odoo module is a python module (data models), with a manifest file, XML and CSV data files (base data, views, menus), frontend resources (Javascript, CSS). · · · ·
  • 8. The Open Academy Module The manifest file __odoo__.py: {{ 'name':: 'Open Academy',, 'version':: '1.0',, 'category':: 'Tools',, 'summary':: 'Courses, Sessions, Subscriptions',, 'description':: "...",, 'depends' :: [['base'],], 'data' :: [['view/menu.xml'],], 'images':: [],[], 'demo':: [],[], 'application':: True,, }}
  • 9. The Course Model A model and its fields are defined in a Python class: fromfrom odoo importimport Model,, fields classclass Course((Model):): _name == 'openacademy.course' name == fields..Char((string=='Title',, required==True)) description == fields..Text()()
  • 10. The Menu as XML data <?xml version="1.0" encoding="UTF-8"?> <openerp><openerp> <data><data> <menuitem<menuitem name="Open Academy" id="menu_root" sequence="110"/>/> <menuitem<menuitem name="General" id="menu_general" parent="menu_root"/>/> <record<record model="ir.actions.act_window" id="action_courses">> <field<field name="name">>Courses</field></field> <field<field name="res_model">>openacademy.course</field></field> <field<field name="view_mode">>tree,form</field></field> </record></record> <menuitem<menuitem name="Courses" id="menu_courses" parent="menu_general" sequence="1" action="action_courses"/>/> </data></data> </openerp></openerp>
  • 11. Let's add a Form View <record<record model="ir.ui.view" id="course_form">> <field<field name="name">>course form view</field></field> <field<field name="model">>openacademy.course</field></field> <field<field name="arch" type="xml">> <form<form string="Course" version="7.0">> <sheet><sheet> <h1><h1> <field<field name="name" placeholder="Course Title"/>/> </h1></h1> <notebook><notebook> <page<page string="Description">> <field<field name="description"/>/> </page></page> </notebook></notebook> </sheet></sheet> </form></form> </field></field> </record></record>
  • 12. The Session Model classclass Session((Model):): _name == 'openacademy.session' name == fields..Char((required==True)) start_date == fields..Date()() duration == fields..Integer((help=="Duration in days")) seats == fields..Integer((string=="Number of Seats"))
  • 13. Relational Fields Let us link sessions to courses and instructors: classclass Session((Model):): _name == 'openacademy.session' ...... course == fields..Many2one(('openacademy.course',, required==True)) instructor == fields..Many2one(('res.partner'))
  • 14. Relational Fields Let us back-link courses and sessions: classclass Course((Model):): _name == 'openacademy.course' ...... responsible == fields..Many2one(('res.users')) sessions == fields..One2many(('openacademy.session',, 'course'))
  • 15. Relational Fields Let us link sessions to partners for attendee subscription: classclass Session((Model):): _name == 'openacademy.session' ...... attendees == fields..Many2many(('res.partner'))
  • 16. Computed Fields The value of those fields is computed: classclass Session((Model):): _name == 'openacademy.session' ...... taken_seats == fields..Float((compute=='_compute_taken_seats')) @api.one@api.one @api.depends@api.depends(('attendees',, 'seats')) defdef _compute_taken_seats((self):): ifif self..seats:: self..taken_seats == 100.0100.0 ** len((self..attendees)) // self..seats elseelse:: self..taken_seats == 0.00.0
  • 17. About self Model instances are recordsetsrecordsets. A recordset is an hybrid concept: collection of records record forfor session inin self:: printprint session..name printprint session..course..name assertassert self..name ==== self[[00]]..name · ·
  • 18. Feedback with "Onchange" Methods Modify form values when some field is filled in: classclass Session((Model):): _name == 'openacademy.session' ...... @api.onchange@api.onchange(('course')) defdef _onchange_course((self):): ifif notnot self..name:: self..name == self..course..name
  • 19. Default Values Specify the initial value to use in a form: classclass Session((Model):): _name == 'openacademy.session' ...... active == fields..Boolean((default==True)) start_date == fields..Date((default==fields..Date..today)) ......
  • 20. Model Constraints Prevent bad data: fromfrom odoo.exceptions importimport WarningWarning classclass Session((Model):): _name == 'openacademy.session' ...... @api.one@api.one @api.constrains@api.constrains(('instructor',, 'attendees')) defdef _check_instructor((self):): ifif self..instructor inin self..attendees:: raiseraise WarningWarning(("Instructor of session '%s' " "cannot attend its own session" %% self..name))
  • 21. More Stuff Extend existing models Many view types Workflows Reports Security Translations · · · · · ·
  • 23. Conclusion Modules have a simple structure Model definition intuitive and efficient uses Python standards (decorators, descriptors) recordsets provide support for "batch" processing many model hooks (default values, constraints, computed fields) · · · · ·