SlideShare a Scribd company logo
1 of 44
Download to read offline
• Software Engineer, RD Dummies Team Leader
Or how to implement a plant nursery in a few
minutes.
EXPERIENCE
2018
The use case:
— Classy Cool Dev
Thanks Classy Cool Dev!
● Three-tier
client/server/database
● Webclient in Javascript
● Server and backend modules
in Python
○ MVC framework
○ ORM to interact with
database
● Manage a plant nursery:
○ List of plants
○ Manage orders
○ Keep a customers list
● You will learn:
○ Structure of a module
○ Definition of data models
○ Definition of views and menus
Structure of an
● A manifest file
● Python code (models, logic)
● Data files, XML and CSV (base data, views, menus)
● Frontend resources (Javascript, CSS)
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Plant Nursery',
'version': '1.0',
'category': 'Tools',
'summary': 'Plants and customers management',
'depends': ['web'],
'data': [
'security/ir.model.access.csv',
'data/data.xml',
'views/views.xml',
],
'demo': [
'data/demo.xml',
],
'css': [],
'installable': True,
'auto_install': False,
'application': True,
}
The manifest file __manifest__.py
plant_nursery/models.py
from odoo import fields, models
class Plants(models.Model):
_name = 'nursery.plant'
name = fields.Char("Plant Name")
price = fields.Float()
class Customer(models.Model):
_name = 'nursery.customer'
name = fields.Char("Customer Name", required=True)
email = fields.Char(help="To receive the newsletter")
https://www.odoo.com/documentation/10.0/reference/orm.html#fields
plant_nursery/security/ir.model.access.csv
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_nursery_plant,access_nursery_plant,plant_nursery.model_nursery_plant,base.group_user,1,1,1,1
access_nursery_customer,access_nursery_customer,plant_nursery.model_nursery_customer,base.group_user,1
,1,1,1
plant_nursery/views/nursery_views.xml
https://www.odoo.com/documentation/10.0/reference/orm.html#fields
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.actions.act_window" id="action_nursery_plant">
<field name="name">Plants</field>
<field name="res_model">nursery.plant</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Plant Nursery" id="nursery_root_menu"
web_icon="plant_nursery,static/description/icon.png"/>
<menuitem name="Plants" id="nursery_plant_menu"
parent="nursery_root_menu"
action="action_nursery_plant"
sequence="1"/>
</odoo>
Auto generated views
https://www.odoo.com/documentation/10.0/reference/orm.html#fields
plant_nursery/views/nursery_views.xml
<record model="ir.ui.view" id="nursery_plant_view_form">
<field name="name">nursery.plant.view.form</field>
<field name="model">nursery.plant</field>
<field name="arch" type="xml">
<form string="Plant">
<sheet>
<h1>
<field name="name" placeholder="Plant Name"/>
</h1>
<notebook>
<page string="Shop">
<group>
<field name="price"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
● Many2one
● One2many
● Many2many
class Order(models.Model):
_name = 'nursery.order'
plant_id = fields.Many2one("nursery.plant", required=True)
customer_id = fields.Many2one("nursery.customer")
class Plants(models.Model):
_name = 'nursery.plant'
order_ids = fields.One2many("nursery.order", "plant_id", string="Orders")
● Read
● Write
● Create
● Unlink
● Search
class Order(models.Model):
_name = 'nursery.order'
name = fields.Datetime(default=fields.Datetime.now)
plant_id = fields.Many2one("nursery.plant", required=True)
customer_id = fields.Many2one("nursery.customer")
state = fields.Selection([
('draft', 'Draft'),
('confirm', 'Confirmed'),
('cancel', 'Canceled')
], default='draft')
last_modification = fields.Datetime(readonly=True)
class Order(model.Models):
_name = 'nursery.order'
def write(self, values):
# helper to "YYYY-MM-DD"
values['last_modification'] = fields.Datetime.now()
return super(Order, self).write(values)
def unlink(self):
# self is a recordset
for order in self:
if order.state == 'confirm':
raise UserError("You can not delete confirmed orders")
return super(Order, self).unlink()
<record model="ir.ui.view" id="nursery_order_form">
<field name="name">Order Form View</field>
<field name="model">nursery.order</field>
<field name="arch" type="xml">
<form string="Plant Order">
<header>
<field name="state" widget="statusbar" options="{'clickable': '1'}"/>
</header>
<sheet>
<group col="4">
<group colspan="2">
<field name="plant_id" />
<field name="customer_id" />
</group>
<group colspan="2">
<field name="last_modification" />
</group>
</group>
</sheet>
</form>
</field>
</record>
— Classy Cool Dev
Thanks Classy Cool Dev!
● For complex values
● Trigger for recompute
● Stored or not in database
class Plants(models.Model):
_name = 'nursery.plant'
order_count = fields.Integer(compute='_compute_order_count',
store=True,
string="Total sold")
@api.depends('order_ids')
def _compute_order_count(self):
for plant in self:
plant.order_count = len(plant.order_ids)
● Triggered after every creation or
modification
● Instead of overriding create & write
class Plants(models.Model):
_name = 'nursery.plant'
number_in_stock = fields.Integer()
@api.constrains('order_count', 'number_in_stock')
def _check_available_in_stock(self):
for plant in self:
if plant.number_in_stock and 
plant.order_count > plant.number_in_stock:
raise UserError("There is only %s %s in stock but %s were sold"
% (plant.number_in_stock, plant.name, plant.order_count))
● Display information in a tile
● Add a picture of the plant
● Aggregated view to visualize the
flow (will need a search view)
class Plants(models.Model):
_name = 'nursery.plant'
image = fields.Binary("Plant Image", attachment=True)
<record model="ir.actions.act_window" id="action_nursery_order">
<field name="name">Orders</field>
<field name="res_model">nursery.order</field>
<field name="view_mode">kanban,tree,form</field>
</record>
<record id="nursery_plant_view_kanban" model="ir.ui.view">
<field name="name">nursery.plant.view.kanban</field>
<field name="model">nursery.plant</field>
<field name="arch" type="xml">
<kanban>
<field name="id"/>
<field name="image"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<img t-att-src="kanban_image('nursery.plant', 'image', record.id.raw_value)"/>
</div>
<div class="oe_kanban_details">
<strong class="o_kanban_record_title"><field name="name"/></strong>
<ul><li><strong>Price: <field name="price"></field></strong></li</ul>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="nursery_order_view_search" model="ir.ui.view">
<field name="name">nursery.order.view.search</field>
<field name="model">nursery.order</field>
<field name="arch" type="xml">
<search string="Search Orders">
<field name="plant_id" string="Plant"/>
<field name="customer_id" string="Customer"/>
<field name="state"/>
<filter string="Confirmed" name="confirmed"
domain="[('state', '=', 'confirm')]"/>
<separator />
<group expand="0" string="Group By">
<filter string="State" name="group_by_state"
domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
class Order(models.Model):
_name = 'nursery.order'
state = fields.Selection([
('draft', 'Draft'),
('confirm', 'Confirmed'),
('cancel', 'Canceled')
], default='draft', group_expand="_expand_states")
def _expand_states(self, states, domain, order):
return [key for key, val in type(self).state.selection]
<record model="ir.actions.act_window" id="action_nursery_order">
<field name="name">Orders</field>
<field name="res_model">nursery.order</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{'search_default_group_by_state': 1}</field>
</record>
#odooexperience
Based on work from Thibault DELAVALLEE and Martin TRIGAUX, that was based on work from Damien BOUVY
https://github.com/tivisse/odoodays-2018
EXPERIENCE
2018

More Related Content

What's hot

От экспериментов с инфраструктурой до внедрения в продакшен
От экспериментов с инфраструктурой до внедрения в продакшенОт экспериментов с инфраструктурой до внедрения в продакшен
От экспериментов с инфраструктурой до внедрения в продакшенDmitry Makhnev
 
Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)sroo galal
 
DJango admin interface
DJango admin interfaceDJango admin interface
DJango admin interfaceMahesh Shitole
 
Casl. isomorphic permission management.pptx
Casl. isomorphic permission management.pptxCasl. isomorphic permission management.pptx
Casl. isomorphic permission management.pptxSergiy Stotskiy
 
Nuxeo World Session: Layouts and Content Views
Nuxeo World Session: Layouts and Content ViewsNuxeo World Session: Layouts and Content Views
Nuxeo World Session: Layouts and Content ViewsNuxeo
 
날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용KyeongMook "Kay" Cha
 
Technical Preview: The New Shopware Admin
Technical Preview: The New Shopware AdminTechnical Preview: The New Shopware Admin
Technical Preview: The New Shopware AdminPhilipp Schuch
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
Обзор автоматизации тестирования на JavaScript
Обзор автоматизации тестирования на JavaScriptОбзор автоматизации тестирования на JavaScript
Обзор автоматизации тестирования на JavaScriptCOMAQA.BY
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS ArchitectureEyal Vardi
 
Drupal.js: Best Practices for Managing Javascript in Drupal
Drupal.js: Best Practices for Managing Javascript in DrupalDrupal.js: Best Practices for Managing Javascript in Drupal
Drupal.js: Best Practices for Managing Javascript in DrupalBryan Braun
 
Customizing the Django Admin
Customizing the Django AdminCustomizing the Django Admin
Customizing the Django AdminLincoln Loop
 
SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant
SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant   SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant
SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant Sencha
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentIvan Chepurnyi
 
Умеете ли вы читать этикетку товара?
Умеете ли вы читать этикетку товара?Умеете ли вы читать этикетку товара?
Умеете ли вы читать этикетку товара?Оксана Одариченко
 

What's hot (20)

Ext JS Introduction
Ext JS IntroductionExt JS Introduction
Ext JS Introduction
 
От экспериментов с инфраструктурой до внедрения в продакшен
От экспериментов с инфраструктурой до внедрения в продакшенОт экспериментов с инфраструктурой до внедрения в продакшен
От экспериментов с инфраструктурой до внедрения в продакшен
 
Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)
 
DJango admin interface
DJango admin interfaceDJango admin interface
DJango admin interface
 
Casl. isomorphic permission management.pptx
Casl. isomorphic permission management.pptxCasl. isomorphic permission management.pptx
Casl. isomorphic permission management.pptx
 
Nuxeo World Session: Layouts and Content Views
Nuxeo World Session: Layouts and Content ViewsNuxeo World Session: Layouts and Content Views
Nuxeo World Session: Layouts and Content Views
 
날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용
 
Technical Preview: The New Shopware Admin
Technical Preview: The New Shopware AdminTechnical Preview: The New Shopware Admin
Technical Preview: The New Shopware Admin
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
javascript examples
javascript examplesjavascript examples
javascript examples
 
Обзор автоматизации тестирования на JavaScript
Обзор автоматизации тестирования на JavaScriptОбзор автоматизации тестирования на JavaScript
Обзор автоматизации тестирования на JavaScript
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
 
Drupal.js: Best Practices for Managing Javascript in Drupal
Drupal.js: Best Practices for Managing Javascript in DrupalDrupal.js: Best Practices for Managing Javascript in Drupal
Drupal.js: Best Practices for Managing Javascript in Drupal
 
Customizing the Django Admin
Customizing the Django AdminCustomizing the Django Admin
Customizing the Django Admin
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
AngularJS Basics with Example
AngularJS Basics with ExampleAngularJS Basics with Example
AngularJS Basics with Example
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
 
SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant
SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant   SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant
SenchaCon 2016: Theming the Modern Toolkit - Phil Guerrant
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
 
Умеете ли вы читать этикетку товара?
Умеете ли вы читать этикетку товара?Умеете ли вы читать этикетку товара?
Умеете ли вы читать этикетку товара?
 

Similar to Odoo Experience 2018 - Develop an App with the Odoo Framework

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
 
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
 
TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5Tieturi Oy
 
Web internship Yii Framework
Web internship  Yii FrameworkWeb internship  Yii Framework
Web internship Yii FrameworkNoveo
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performanceEngine Yard
 
ASP.Net Presentation Part3
ASP.Net Presentation Part3ASP.Net Presentation Part3
ASP.Net Presentation Part3Neeraj Mathur
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WAREFermin Galan
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3masahiroookubo
 
Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"Fwdays
 
Single page apps_with_cf_and_angular[1]
Single page apps_with_cf_and_angular[1]Single page apps_with_cf_and_angular[1]
Single page apps_with_cf_and_angular[1]ColdFusionConference
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesNCCOMMS
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortalJennifer Bourey
 
Dexterity in the Wild
Dexterity in the WildDexterity in the Wild
Dexterity in the WildDavid Glick
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012crokitta
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfoliocummings49
 
Um roadmap do Framework Ruby on Rails, do Rails 1 ao Rails 4 - DevDay 2013
Um roadmap do Framework Ruby on Rails, do Rails 1 ao Rails 4 - DevDay 2013Um roadmap do Framework Ruby on Rails, do Rails 1 ao Rails 4 - DevDay 2013
Um roadmap do Framework Ruby on Rails, do Rails 1 ao Rails 4 - DevDay 2013Joao Lucas Santana
 

Similar to Odoo Experience 2018 - Develop an App with the Odoo Framework (20)

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
 
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
 
TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5
 
Web internship Yii Framework
Web internship  Yii FrameworkWeb internship  Yii Framework
Web internship Yii Framework
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
ASP.Net Presentation Part3
ASP.Net Presentation Part3ASP.Net Presentation Part3
ASP.Net Presentation Part3
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3
 
Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"Кирилл Латыш "ERP on Websockets"
Кирилл Латыш "ERP on Websockets"
 
Single page apps_with_cf_and_angular[1]
Single page apps_with_cf_and_angular[1]Single page apps_with_cf_and_angular[1]
Single page apps_with_cf_and_angular[1]
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_libraries
 
Sql Portfolio
Sql PortfolioSql Portfolio
Sql Portfolio
 
Stripes Framework
Stripes FrameworkStripes Framework
Stripes Framework
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
Nuxeo JavaOne 2007
Nuxeo JavaOne 2007Nuxeo JavaOne 2007
Nuxeo JavaOne 2007
 
Dexterity in the Wild
Dexterity in the WildDexterity in the Wild
Dexterity in the Wild
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfolio
 
Um roadmap do Framework Ruby on Rails, do Rails 1 ao Rails 4 - DevDay 2013
Um roadmap do Framework Ruby on Rails, do Rails 1 ao Rails 4 - DevDay 2013Um roadmap do Framework Ruby on Rails, do Rails 1 ao Rails 4 - DevDay 2013
Um roadmap do Framework Ruby on Rails, do Rails 1 ao Rails 4 - DevDay 2013
 

More from ElínAnna Jónasdóttir

Odoo Experience 2018 - Connect Your PoS to Hardware
Odoo Experience 2018 - Connect Your PoS to HardwareOdoo Experience 2018 - Connect Your PoS to Hardware
Odoo Experience 2018 - Connect Your PoS to HardwareElínAnna Jónasdóttir
 
Odoo Experience 2018 - Odoo Studio as a Prototyping Tool
Odoo Experience 2018 - Odoo Studio as a Prototyping ToolOdoo Experience 2018 - Odoo Studio as a Prototyping Tool
Odoo Experience 2018 - Odoo Studio as a Prototyping ToolElínAnna Jónasdóttir
 
Odoo Experience 2018 - Odoo Studio: A Functional Approach
Odoo Experience 2018 - Odoo Studio: A Functional ApproachOdoo Experience 2018 - Odoo Studio: A Functional Approach
Odoo Experience 2018 - Odoo Studio: A Functional ApproachElínAnna Jónasdóttir
 
Odoo Experience 2018 - GDPR: How Odoo Can Help You with Complieance
Odoo Experience 2018 - GDPR: How Odoo Can Help You with ComplieanceOdoo Experience 2018 - GDPR: How Odoo Can Help You with Complieance
Odoo Experience 2018 - GDPR: How Odoo Can Help You with ComplieanceElínAnna Jónasdóttir
 
Odoo Experience 2018 - How to Break Odoo Security (or how to prevent it)
Odoo Experience 2018 - How to Break Odoo Security (or how to prevent it)Odoo Experience 2018 - How to Break Odoo Security (or how to prevent it)
Odoo Experience 2018 - How to Break Odoo Security (or how to prevent it)ElínAnna Jónasdóttir
 
Odoo Experience 2018 - Multi-Channel Sales: The Future of Retail
Odoo Experience 2018 - Multi-Channel Sales: The Future of RetailOdoo Experience 2018 - Multi-Channel Sales: The Future of Retail
Odoo Experience 2018 - Multi-Channel Sales: The Future of RetailElínAnna Jónasdóttir
 
Odoo Experience 2018 - Speed Up Credit Collection with Automated Follow-Ups
Odoo Experience 2018 - Speed Up Credit Collection with Automated Follow-UpsOdoo Experience 2018 - Speed Up Credit Collection with Automated Follow-Ups
Odoo Experience 2018 - Speed Up Credit Collection with Automated Follow-UpsElínAnna Jónasdóttir
 
Odoo Experience 2018 - Improve Your Visibility and Prospect Better with Odoo
Odoo Experience 2018 - Improve Your Visibility and Prospect Better with OdooOdoo Experience 2018 - Improve Your Visibility and Prospect Better with Odoo
Odoo Experience 2018 - Improve Your Visibility and Prospect Better with OdooElínAnna Jónasdóttir
 
Odoo Experience 2018 - Organize Your Operations in a Startup Environment
Odoo Experience 2018 - Organize Your Operations in a Startup EnvironmentOdoo Experience 2018 - Organize Your Operations in a Startup Environment
Odoo Experience 2018 - Organize Your Operations in a Startup EnvironmentElínAnna Jónasdóttir
 
Odoo Experience 2018 - Best Practices to Close Deals
Odoo Experience 2018 - Best Practices to Close DealsOdoo Experience 2018 - Best Practices to Close Deals
Odoo Experience 2018 - Best Practices to Close DealsElínAnna Jónasdóttir
 
Odoo Experience 2018 - Customer Success Team: How Do We Work?
Odoo Experience 2018 - Customer Success Team: How Do We Work?Odoo Experience 2018 - Customer Success Team: How Do We Work?
Odoo Experience 2018 - Customer Success Team: How Do We Work?ElínAnna Jónasdóttir
 
Odoo Experience 2018 - Customer Success Team: Meet our Experts
Odoo Experience 2018 - Customer Success Team: Meet our ExpertsOdoo Experience 2018 - Customer Success Team: Meet our Experts
Odoo Experience 2018 - Customer Success Team: Meet our ExpertsElínAnna Jónasdóttir
 
Odoo Experience 2018 - How a Feedback Loop Helps to Fine-Tune Your Manufactu...
Odoo Experience 2018 -  How a Feedback Loop Helps to Fine-Tune Your Manufactu...Odoo Experience 2018 -  How a Feedback Loop Helps to Fine-Tune Your Manufactu...
Odoo Experience 2018 - How a Feedback Loop Helps to Fine-Tune Your Manufactu...ElínAnna Jónasdóttir
 
Odoo Experience 2018 - Successful Import of Big Data with an Efficient Tool
Odoo Experience 2018 - Successful Import of Big Data with an Efficient ToolOdoo Experience 2018 - Successful Import of Big Data with an Efficient Tool
Odoo Experience 2018 - Successful Import of Big Data with an Efficient ToolElínAnna Jónasdóttir
 
Odoo Experience 2018 - Inventory: Advanced Flow with the New Barcode
Odoo Experience 2018 - Inventory: Advanced Flow with the New BarcodeOdoo Experience 2018 - Inventory: Advanced Flow with the New Barcode
Odoo Experience 2018 - Inventory: Advanced Flow with the New BarcodeElínAnna Jónasdóttir
 
Odoo Experience 2018 - Easypost: New Shipping Connector
Odoo Experience 2018 - Easypost: New Shipping Connector Odoo Experience 2018 - Easypost: New Shipping Connector
Odoo Experience 2018 - Easypost: New Shipping Connector ElínAnna Jónasdóttir
 
Odoo Experience 2018 - Project Methodology: The Editor Stance
Odoo Experience 2018 - Project Methodology: The Editor StanceOdoo Experience 2018 - Project Methodology: The Editor Stance
Odoo Experience 2018 - Project Methodology: The Editor StanceElínAnna Jónasdóttir
 
Odoo Experience 2018 - Grow Your Business with In-App Purchases
Odoo Experience 2018 -  Grow Your Business with In-App PurchasesOdoo Experience 2018 -  Grow Your Business with In-App Purchases
Odoo Experience 2018 - Grow Your Business with In-App PurchasesElínAnna Jónasdóttir
 
Odoo Experience 2018 - All You Need to Know About Odoo's Partnership
Odoo Experience 2018 - All You Need to Know About Odoo's PartnershipOdoo Experience 2018 - All You Need to Know About Odoo's Partnership
Odoo Experience 2018 - All You Need to Know About Odoo's PartnershipElínAnna Jónasdóttir
 
Odoo Experience 2018 - How to Manage Accounting Firms with Odoo?
Odoo Experience 2018 - How to Manage Accounting Firms with Odoo?Odoo Experience 2018 - How to Manage Accounting Firms with Odoo?
Odoo Experience 2018 - How to Manage Accounting Firms with Odoo?ElínAnna Jónasdóttir
 

More from ElínAnna Jónasdóttir (20)

Odoo Experience 2018 - Connect Your PoS to Hardware
Odoo Experience 2018 - Connect Your PoS to HardwareOdoo Experience 2018 - Connect Your PoS to Hardware
Odoo Experience 2018 - Connect Your PoS to Hardware
 
Odoo Experience 2018 - Odoo Studio as a Prototyping Tool
Odoo Experience 2018 - Odoo Studio as a Prototyping ToolOdoo Experience 2018 - Odoo Studio as a Prototyping Tool
Odoo Experience 2018 - Odoo Studio as a Prototyping Tool
 
Odoo Experience 2018 - Odoo Studio: A Functional Approach
Odoo Experience 2018 - Odoo Studio: A Functional ApproachOdoo Experience 2018 - Odoo Studio: A Functional Approach
Odoo Experience 2018 - Odoo Studio: A Functional Approach
 
Odoo Experience 2018 - GDPR: How Odoo Can Help You with Complieance
Odoo Experience 2018 - GDPR: How Odoo Can Help You with ComplieanceOdoo Experience 2018 - GDPR: How Odoo Can Help You with Complieance
Odoo Experience 2018 - GDPR: How Odoo Can Help You with Complieance
 
Odoo Experience 2018 - How to Break Odoo Security (or how to prevent it)
Odoo Experience 2018 - How to Break Odoo Security (or how to prevent it)Odoo Experience 2018 - How to Break Odoo Security (or how to prevent it)
Odoo Experience 2018 - How to Break Odoo Security (or how to prevent it)
 
Odoo Experience 2018 - Multi-Channel Sales: The Future of Retail
Odoo Experience 2018 - Multi-Channel Sales: The Future of RetailOdoo Experience 2018 - Multi-Channel Sales: The Future of Retail
Odoo Experience 2018 - Multi-Channel Sales: The Future of Retail
 
Odoo Experience 2018 - Speed Up Credit Collection with Automated Follow-Ups
Odoo Experience 2018 - Speed Up Credit Collection with Automated Follow-UpsOdoo Experience 2018 - Speed Up Credit Collection with Automated Follow-Ups
Odoo Experience 2018 - Speed Up Credit Collection with Automated Follow-Ups
 
Odoo Experience 2018 - Improve Your Visibility and Prospect Better with Odoo
Odoo Experience 2018 - Improve Your Visibility and Prospect Better with OdooOdoo Experience 2018 - Improve Your Visibility and Prospect Better with Odoo
Odoo Experience 2018 - Improve Your Visibility and Prospect Better with Odoo
 
Odoo Experience 2018 - Organize Your Operations in a Startup Environment
Odoo Experience 2018 - Organize Your Operations in a Startup EnvironmentOdoo Experience 2018 - Organize Your Operations in a Startup Environment
Odoo Experience 2018 - Organize Your Operations in a Startup Environment
 
Odoo Experience 2018 - Best Practices to Close Deals
Odoo Experience 2018 - Best Practices to Close DealsOdoo Experience 2018 - Best Practices to Close Deals
Odoo Experience 2018 - Best Practices to Close Deals
 
Odoo Experience 2018 - Customer Success Team: How Do We Work?
Odoo Experience 2018 - Customer Success Team: How Do We Work?Odoo Experience 2018 - Customer Success Team: How Do We Work?
Odoo Experience 2018 - Customer Success Team: How Do We Work?
 
Odoo Experience 2018 - Customer Success Team: Meet our Experts
Odoo Experience 2018 - Customer Success Team: Meet our ExpertsOdoo Experience 2018 - Customer Success Team: Meet our Experts
Odoo Experience 2018 - Customer Success Team: Meet our Experts
 
Odoo Experience 2018 - How a Feedback Loop Helps to Fine-Tune Your Manufactu...
Odoo Experience 2018 -  How a Feedback Loop Helps to Fine-Tune Your Manufactu...Odoo Experience 2018 -  How a Feedback Loop Helps to Fine-Tune Your Manufactu...
Odoo Experience 2018 - How a Feedback Loop Helps to Fine-Tune Your Manufactu...
 
Odoo Experience 2018 - Successful Import of Big Data with an Efficient Tool
Odoo Experience 2018 - Successful Import of Big Data with an Efficient ToolOdoo Experience 2018 - Successful Import of Big Data with an Efficient Tool
Odoo Experience 2018 - Successful Import of Big Data with an Efficient Tool
 
Odoo Experience 2018 - Inventory: Advanced Flow with the New Barcode
Odoo Experience 2018 - Inventory: Advanced Flow with the New BarcodeOdoo Experience 2018 - Inventory: Advanced Flow with the New Barcode
Odoo Experience 2018 - Inventory: Advanced Flow with the New Barcode
 
Odoo Experience 2018 - Easypost: New Shipping Connector
Odoo Experience 2018 - Easypost: New Shipping Connector Odoo Experience 2018 - Easypost: New Shipping Connector
Odoo Experience 2018 - Easypost: New Shipping Connector
 
Odoo Experience 2018 - Project Methodology: The Editor Stance
Odoo Experience 2018 - Project Methodology: The Editor StanceOdoo Experience 2018 - Project Methodology: The Editor Stance
Odoo Experience 2018 - Project Methodology: The Editor Stance
 
Odoo Experience 2018 - Grow Your Business with In-App Purchases
Odoo Experience 2018 -  Grow Your Business with In-App PurchasesOdoo Experience 2018 -  Grow Your Business with In-App Purchases
Odoo Experience 2018 - Grow Your Business with In-App Purchases
 
Odoo Experience 2018 - All You Need to Know About Odoo's Partnership
Odoo Experience 2018 - All You Need to Know About Odoo's PartnershipOdoo Experience 2018 - All You Need to Know About Odoo's Partnership
Odoo Experience 2018 - All You Need to Know About Odoo's Partnership
 
Odoo Experience 2018 - How to Manage Accounting Firms with Odoo?
Odoo Experience 2018 - How to Manage Accounting Firms with Odoo?Odoo Experience 2018 - How to Manage Accounting Firms with Odoo?
Odoo Experience 2018 - How to Manage Accounting Firms with Odoo?
 

Recently uploaded

Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxmavinoikein
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Motivation and Theory Maslow and Murray pdf
Motivation and Theory Maslow and Murray pdfMotivation and Theory Maslow and Murray pdf
Motivation and Theory Maslow and Murray pdfakankshagupta7348026
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...NETWAYS
 
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...NETWAYS
 
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...NETWAYS
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@vikas rana
 
Philippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.pptPhilippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.pptssuser319dad
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Kayode Fayemi
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSebastiano Panichella
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024eCommerce Institute
 
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝soniya singh
 
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...henrik385807
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Salam Al-Karadaghi
 
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Delhi Call girls
 
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024eCommerce Institute
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSebastiano Panichella
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Pooja Nehwal
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )Pooja Nehwal
 

Recently uploaded (20)

Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptx
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
 
Motivation and Theory Maslow and Murray pdf
Motivation and Theory Maslow and Murray pdfMotivation and Theory Maslow and Murray pdf
Motivation and Theory Maslow and Murray pdf
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
Open Source Camp Kubernetes 2024 | Running WebAssembly on Kubernetes by Alex ...
 
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
 
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@
 
Philippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.pptPhilippine History cavite Mutiny Report.ppt
Philippine History cavite Mutiny Report.ppt
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation Track
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024
 
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
 
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
 
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
 
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
 

Odoo Experience 2018 - Develop an App with the Odoo Framework

  • 1. • Software Engineer, RD Dummies Team Leader Or how to implement a plant nursery in a few minutes. EXPERIENCE 2018
  • 2.
  • 6. ● Three-tier client/server/database ● Webclient in Javascript ● Server and backend modules in Python ○ MVC framework ○ ORM to interact with database
  • 7. ● Manage a plant nursery: ○ List of plants ○ Manage orders ○ Keep a customers list
  • 8. ● You will learn: ○ Structure of a module ○ Definition of data models ○ Definition of views and menus
  • 10. ● A manifest file ● Python code (models, logic) ● Data files, XML and CSV (base data, views, menus) ● Frontend resources (Javascript, CSS)
  • 11. # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Plant Nursery', 'version': '1.0', 'category': 'Tools', 'summary': 'Plants and customers management', 'depends': ['web'], 'data': [ 'security/ir.model.access.csv', 'data/data.xml', 'views/views.xml', ], 'demo': [ 'data/demo.xml', ], 'css': [], 'installable': True, 'auto_install': False, 'application': True, } The manifest file __manifest__.py
  • 12. plant_nursery/models.py from odoo import fields, models class Plants(models.Model): _name = 'nursery.plant' name = fields.Char("Plant Name") price = fields.Float() class Customer(models.Model): _name = 'nursery.customer' name = fields.Char("Customer Name", required=True) email = fields.Char(help="To receive the newsletter") https://www.odoo.com/documentation/10.0/reference/orm.html#fields
  • 14. plant_nursery/views/nursery_views.xml https://www.odoo.com/documentation/10.0/reference/orm.html#fields <?xml version="1.0" encoding="UTF-8"?> <odoo> <record model="ir.actions.act_window" id="action_nursery_plant"> <field name="name">Plants</field> <field name="res_model">nursery.plant</field> <field name="view_mode">tree,form</field> </record> <menuitem name="Plant Nursery" id="nursery_root_menu" web_icon="plant_nursery,static/description/icon.png"/> <menuitem name="Plants" id="nursery_plant_menu" parent="nursery_root_menu" action="action_nursery_plant" sequence="1"/> </odoo>
  • 16.
  • 17. plant_nursery/views/nursery_views.xml <record model="ir.ui.view" id="nursery_plant_view_form"> <field name="name">nursery.plant.view.form</field> <field name="model">nursery.plant</field> <field name="arch" type="xml"> <form string="Plant"> <sheet> <h1> <field name="name" placeholder="Plant Name"/> </h1> <notebook> <page string="Shop"> <group> <field name="price"/> </group> </page> </notebook> </sheet> </form> </field> </record>
  • 18.
  • 19.
  • 21. class Order(models.Model): _name = 'nursery.order' plant_id = fields.Many2one("nursery.plant", required=True) customer_id = fields.Many2one("nursery.customer") class Plants(models.Model): _name = 'nursery.plant' order_ids = fields.One2many("nursery.order", "plant_id", string="Orders")
  • 22.
  • 23.
  • 24. ● Read ● Write ● Create ● Unlink ● Search
  • 25. class Order(models.Model): _name = 'nursery.order' name = fields.Datetime(default=fields.Datetime.now) plant_id = fields.Many2one("nursery.plant", required=True) customer_id = fields.Many2one("nursery.customer") state = fields.Selection([ ('draft', 'Draft'), ('confirm', 'Confirmed'), ('cancel', 'Canceled') ], default='draft') last_modification = fields.Datetime(readonly=True)
  • 26. class Order(model.Models): _name = 'nursery.order' def write(self, values): # helper to "YYYY-MM-DD" values['last_modification'] = fields.Datetime.now() return super(Order, self).write(values) def unlink(self): # self is a recordset for order in self: if order.state == 'confirm': raise UserError("You can not delete confirmed orders") return super(Order, self).unlink()
  • 27. <record model="ir.ui.view" id="nursery_order_form"> <field name="name">Order Form View</field> <field name="model">nursery.order</field> <field name="arch" type="xml"> <form string="Plant Order"> <header> <field name="state" widget="statusbar" options="{'clickable': '1'}"/> </header> <sheet> <group col="4"> <group colspan="2"> <field name="plant_id" /> <field name="customer_id" /> </group> <group colspan="2"> <field name="last_modification" /> </group> </group> </sheet> </form> </field> </record>
  • 28.
  • 31. ● For complex values ● Trigger for recompute ● Stored or not in database
  • 32. class Plants(models.Model): _name = 'nursery.plant' order_count = fields.Integer(compute='_compute_order_count', store=True, string="Total sold") @api.depends('order_ids') def _compute_order_count(self): for plant in self: plant.order_count = len(plant.order_ids)
  • 33. ● Triggered after every creation or modification ● Instead of overriding create & write
  • 34. class Plants(models.Model): _name = 'nursery.plant' number_in_stock = fields.Integer() @api.constrains('order_count', 'number_in_stock') def _check_available_in_stock(self): for plant in self: if plant.number_in_stock and plant.order_count > plant.number_in_stock: raise UserError("There is only %s %s in stock but %s were sold" % (plant.number_in_stock, plant.name, plant.order_count))
  • 35. ● Display information in a tile ● Add a picture of the plant ● Aggregated view to visualize the flow (will need a search view)
  • 36. class Plants(models.Model): _name = 'nursery.plant' image = fields.Binary("Plant Image", attachment=True) <record model="ir.actions.act_window" id="action_nursery_order"> <field name="name">Orders</field> <field name="res_model">nursery.order</field> <field name="view_mode">kanban,tree,form</field> </record>
  • 37. <record id="nursery_plant_view_kanban" model="ir.ui.view"> <field name="name">nursery.plant.view.kanban</field> <field name="model">nursery.plant</field> <field name="arch" type="xml"> <kanban> <field name="id"/> <field name="image"/> <templates> <t t-name="kanban-box"> <div class="oe_kanban_global_click"> <div class="o_kanban_image"> <img t-att-src="kanban_image('nursery.plant', 'image', record.id.raw_value)"/> </div> <div class="oe_kanban_details"> <strong class="o_kanban_record_title"><field name="name"/></strong> <ul><li><strong>Price: <field name="price"></field></strong></li</ul> </div> </div> </t> </templates> </kanban> </field> </record>
  • 38.
  • 39.
  • 40. <record id="nursery_order_view_search" model="ir.ui.view"> <field name="name">nursery.order.view.search</field> <field name="model">nursery.order</field> <field name="arch" type="xml"> <search string="Search Orders"> <field name="plant_id" string="Plant"/> <field name="customer_id" string="Customer"/> <field name="state"/> <filter string="Confirmed" name="confirmed" domain="[('state', '=', 'confirm')]"/> <separator /> <group expand="0" string="Group By"> <filter string="State" name="group_by_state" domain="[]" context="{'group_by':'state'}"/> </group> </search> </field> </record>
  • 41. class Order(models.Model): _name = 'nursery.order' state = fields.Selection([ ('draft', 'Draft'), ('confirm', 'Confirmed'), ('cancel', 'Canceled') ], default='draft', group_expand="_expand_states") def _expand_states(self, states, domain, order): return [key for key, val in type(self).state.selection]
  • 42. <record model="ir.actions.act_window" id="action_nursery_order"> <field name="name">Orders</field> <field name="res_model">nursery.order</field> <field name="view_mode">kanban,tree,form</field> <field name="context">{'search_default_group_by_state': 1}</field> </record>
  • 43.
  • 44. #odooexperience Based on work from Thibault DELAVALLEE and Martin TRIGAUX, that was based on work from Damien BOUVY https://github.com/tivisse/odoodays-2018 EXPERIENCE 2018