O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Odoo 11 Development Essentials - Third Edition

Book Description

Fast track your development skills to build resourceful, open-source business applications with Odoo 11

About This Book

  • Discover the latest technical capabilities in Odoo 11 while you build your own app
  • Program business logic and manipulate data to implement specific business rules in your applications
  • Implement automated tests to add modules and techniques and debug module business logic

Who This Book Is For

Odoo 11 Development Essentials caters to developers who are familiar with Python and MVC design and now want to build effective business applications using Odoo.

What You Will Learn

  • Install Odoo from source
  • Manage Odoo server instances
  • Create a new Odoo application from scratch covering the most frequently used elements
  • Develop new models and use inheritance to extend/modify existing models
  • Use ORM methods, both in the Odoo server and from external clients
  • Create Kanban views using QWeb effectively
  • Develop custom web and website CMS pages
  • Use external API to integrate Odoo with external applications

In Detail

Odoo continues to gain worldwide momentum as the best platform for open source ERP installations. Now, with Odoo 11, you have access to an improved GUI, performance optimization, integrated in-app purchase features, and a fast-growing community to help transform and modernize your business. With this practical guide, you will cover all the new features that Odoo 11 has to offer to build and customize business applications, focusing on the publicly available community edition.

We begin with setting up a development environment, and as you make your way through the chapters, you will learn to build feature-rich business applications. With the aim of jump-starting your Odoo proficiency level, from no specific knowledge to application development readiness, you will develop your first Odoo application. We then move on to topics such as models and views, and understand how to use server APIs to add business logic, helping to lay a solid foundation for advanced topics.

The book concludes with Odoo interactions and how to use the Odoo API from other programs, all of which will enable you to efficiently integrate applications with other external systems.

Style and Approach

This fast-paced tutorial explains topics with the help of practical examples to help you understand each chapter efficiently.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Odoo 11 Development Essentials Third Edition
  3. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  4. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  6. Quick Start – The Odoo Developer Mode and Concepts
    1. The Odoo architecture
    2. The Developer mode
    3. Introducing the Library project
      1. Creating a work database
      2. Enabling the developer tools
    4. Adding a field to an existing Model
    5. Adding Menus, Models, and Views
      1. Creating menus
      2. Creating a Custom Model
      3. Creating Views
    6. Configuring access control security
    7. About Odoo base Models
    8. Summary
  7. Installing and Organizing the Development Environment
    1. Setting up a host for the Odoo server
      1. Using a virtual machine
      2. Installing a Linux server
    2. Installing Odoo from source
    3. Initializing a new Odoo database
      1. Managing Odoo databases
    4. A word about Odoo product versions
    5. More server configuration options
      1. Odoo server configuration files
      2. Changing the listening port
      3. The database filter option
      4. Managing server log messages
    6. Developing from a remote workstation
      1. Using a Linux text editor
      2. Installing and configuring Samba
    7. Installing additional modules
      1. Finding community modules
      2. Configuring the addons path
      3. Updating the apps list
    8. Summary
  8. Your First Odoo Application – A Practical Overview
    1. Creating a new addon module
      1. Creating the module's basic skeleton
      2. Adding an icon
      3. A word about licenses
    2. Discovering and installing new modules
      1. Adding to the addons path
      2. Installing the new module
      3. Upgrading a module
      4. The server development mode
    3. The model layer
      1. Creating the data model
      2. Extending existing models
    4. The view layer
      1. Adding menu items
      2. Creating the form view
      3. Business document form views
      4. Adding action buttons
      5. Using groups to organize forms
      6. The complete form view
      7. Adding list and search views
      8. Extending views
    5. The business logic layer
      1. Adding business logic
      2. Extending Python methods
      3. Adding automated tests
      4. Testing business logic
      5. Testing access security
    6. Setting up access security
      1. Adding access control security
      2. Row-level access rules
    7. Web pages and controllers
    8. Summary
  9. Models – Structuring the Application Data
    1. Organizing application features into modules
      1. Introducing the todo_stage module
    2. Creating models
      1. Model attributes
      2. Models and Python classes
      3. Transient and Abstract models
      4. Inspecting existing models
    3. Creating fields
      1. Basic field types
      2. Common field attributes
      3. Special field names
    4. Extending models
      1. Adding fields to a model
      2. Modifying existing fields
    5. Relationships between models
      1. Many-to-one relationships
      2. Many-to-many relationships
      3. One-to-many inverse relationships
      4. Hierarchical relationships
      5. Dynamic relationships using Reference fields
    6. Computed fields
      1. Searching and writing to computed fields
      2. Storing computed fields
      3. Related fields
    7. Model constraints
    8. More model inheritance mechanisms
      1. Copying features with prototype inheritance
      2. Embedding models using delegation inheritance
    9. Summary
  10. Import, Export, and Module Data
    1. Understanding external identifiers
      1. Finding external identifiers
    2. Exporting and importing data
      1. Exporting data
      2. Importing data
      3. Related records in CSV data files
    3. Module data
      1. Demonstration data
    4. XML data files
      1. The noupdate data attribute
      2. Defining records in XML
        1. Setting field values
        2. Setting values using expressions
        3. Setting values for relation fields
      3. Shortcuts for frequently used models
      4. Other actions in XML data files
        1. Deleting records
        2. Triggering functions
    5. Modifying data
    6. Summary
  11. The ORM API – Handling Application Data
    1. Understanding the ORM decorators
      1. Record handling decorators
      2. Specific purpose decorators
    2. Using the ORM built-in methods
      1. Methods for writing model data
      2. Methods for web client use over RPC
      3. Methods for data import and export
      4. Methods for the user interface
    3. The Mail and Social features API
      1. Message subtypes
      2. Posting messages
      3. Adding followers
    4. Summary
  12. Business Logic – Supporting Business Processes
    1. Creating a wizard
      1. The wizard model
      2. The wizard form
      3. The wizard business logic
      4. Logging
      5. Raising exceptions
      6. Helper actions in wizards
    2. Working with the ORM API
      1. The shell command
      2. The server environment
      3. Modifying the execution environment
      4. Transactions and low-level SQL
    3. Context and domain
      1. Context data
      2. Domain expressions
    4. Working with recordsets
      1. Querying models
      2. Singletons
      3. Writing on records
      4. Working with time and dates
      5. Operations on recordsets
      6. Manipulating recordsets
      7. Using relational fields
      8. Working with relational fields
    5. Summary
  13. External API – Integrating with Other Systems
    1. Setting up a Python client
    2. Calling the Odoo API using XML-RPC
      1. Opening an XML-RPC connection
      2. Reading data from the server
      3. Calling other methods
    3. Writing a To-Do client application
      1. Communication layer with Odoo
      2. Creating the CLI
    4. Introducing the ERPpeek client
      1. The ERPpeek API
      2. The ERPpeek CLI
    5. Introducing the OdooRPC library
    6. Summary
  14. Backend Views – Design the User Interface
    1. Defining the user interface with XML files
      1. Menu items
      2. Window actions
    2. The form views
      1. Dealing with several views of the same type
      2. Business document views
        1. The header
        2. The document sheet
        3. Title and subtitle
        4. Smart buttons area
        5. Grouping content in a form
        6. Tabbed notebooks
    3. View semantic components
      1. Fields
        1. Labels for fields
        2. Relational fields
        3. Field widgets
      2. Buttons
      3. Smart buttons
    4. Dynamic views
      1. On change events
      2. Dynamic attributes
    5. List views
    6. Search views
    7. Calendar views
    8. Graph and pivot views
    9. Other view types
    10. Summary
  15. Kanban Views and Client-Side QWeb
    1. About Kanban boards
      1. Kanban views
    2. Designing Kanban views
      1. Priority, kanban state, and color
      2. Kanban card elements
      3. The Kanban card layout
      4. Adding a Kanban card option menu
      5. Actions in Kanban views
    3. The QWeb templating language
      1. The QWeb JavaScript evaluation context
      2. Dynamic attributes by string substitution – t-attf
      3. Dynamic attributes by expressions – t-att
      4. Loops – t-foreach
      5. Conditionals – t-if
      6. Rendering values – t-esc and t-raw
      7. Set values on variables – t-set
      8. Call and reuse other templates – t-call
      9. Dynamic attributes using dicts and lists
    4. Inheritance on Kanban views
    5. Custom CSS and JavaScript assets
    6. Summary
  16. Reports and Server-Side QWeb
    1. Installing wkhtmltopdf
    2. Creating business reports
    3. QWeb report templates
    4. Presenting data in reports
    5. Rendering images
    6. Report totals
    7. Defining paper formats
    8. Enabling language translation in reports
    9. Reports based on custom SQL
    10. Summary
  17. Creating Website Frontend Features
    1. Roadmap
    2. Our first web page
      1. Hello World!
      2. Hello World! with a QWeb template
      3. Extending web features
      4. HelloCMS!
    3. Building websites
      1. Adding CSS and JavaScript assets
      2. The to-do list controller
      3. The to-do list template
      4. The To-Do Task detail page
    4. Website forms
      1. The form page
      2. Accessing the security and menu item
      3. Adding custom logic
    5. Summary
  18. Debugging and Automated Tests
    1. Unit tests
      1. Adding unit tests
      2. Setting up tests
      3. Writing test cases
      4. Testing exceptions
      5. Running tests
      6. About YAML tests
    2. Development tools
      1. Server development options
      2. Debugging
        1. The Python debugger  
        2. A sample debugging session
        3. Alternative Python debuggers
        4. Printing messages and logging 
      3. Killing running processes
    3. Summary
  19. Deploying and Maintaining Production Instances
    1. Available prebuilt packages
    2. Installing dependencies
      1. Preparing a dedicated system user
      2. Installing from the source code
      3. Setting up the configuration file
    3. Multiprocessing workers
      1. Setting up Odoo as a system service
      2. Creating a systemd service
      3. Creating an Upstart/sysvinit service
      4. Checking the Odoo service from the command line
    4. Using a reverse proxy
      1. Setting up Nginx as a reverse proxy
      2. Enforcing HTTPS
      3. Nginx optimizations
      4. Long polling
    5. Server and module updates
    6. Summary
  20. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think