0%

Book Description

Extend your skills with Odoo 12 to build resourceful and open source business applications

Key Features

  • Explore Odoo 12 capabilities to develop business applications
  • Program business logic and manipulate data to implement specific business rules in your applications
  • Integrate Python APIs for building customizable and scalable business logic

Book Description

Odoo is one of the best platforms for open source ERP and CRM. Its latest version, Odoo 12, brings with it new features and updates in Python packages to develop more customizable applications with additional cloud capabilities.

The book begins by covering the development essentials for building business applications. You will start your journey by learning how to install and configure Odoo, and then transition from having no specific knowledge of Odoo to being ready for application development. You will develop your first Odoo application and understand topics such as models and views. Odoo 12 Development Essentials will also guide you in using server APIs to add business logic, helping you lay a solid foundation for advanced topics. As you progress through the chapters, you will be equipped to build and customize your applications and explore the new features in Odoo 12, such as cloud integration, to scale your business applications. You will get insights into building business logic and integrating various APIs into your application.

By the end of the book, you will be able to build a business application from scratch by using the latest version of Odoo.

What you will learn

  • Manage Odoo server instances
  • Create a new Odoo application from scratch using the most frequently used elements
  • Develop new models and use inheritance to extend existing models
  • Use ORM methods in the Odoo server and from external clients
  • Create Kanban views using QWeb effectively
  • Build custom web and website CMS pages
  • Use external APIs to integrate Odoo with external applications
  • Add automated tests and techniques to debug module business logic

Who this book is for

If you are a developer familiar with Python and MVC design and want to build business applications using Odoo, this book is for you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Odoo 12 Development Essentials Fourth Edition
  3. Packt Upsell
    1. Why subscribe?
    2. Packt.com
  4. Foreword
  5. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  6. 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. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  7. Quick Start Using the Developer Mode
    1. Technical requirements
    2. Introducing the to-do list project
    3. Basic concepts
      1. The Odoo architecture
      2. Odoo community versus Odoo enterprise
      3. Odoo version policy
    4. Preparing a basic work environment
      1. Using an Odoo SaaS trial database
      2. Installing Odoo on Windows
      3. Installing Odoo using Docker containers
      4. Other installation options
      5. Creating a work database
      6. Enabling the developer mode
    5. Modifying an existing model to add a field
      1. Adding a field to a Model
      2. Adding a field to a form view
    6. Creating a new Model
    7. Configuring access control security
      1. Security groups
      2. Security access control lists
      3. Security record rules
      4. The superuser account
    8. Creating menu items
    9. Creating views
      1. List views
      2. Form views
      3. Search views
    10. Summary
    11. Questions
  8. Preparing the Development Environment
    1. Technical requirements
    2. Setting up a host for the Odoo server
      1. Installing the Windows Subsystem for Linux
      2. Installing a Linux server
    3. Installing Odoo from source
      1. Installing the PostgreSQL database
      2. Installing Odoo system dependencies
      3. Installing Odoo from source
      4. Initializing a new Odoo database
    4. Managing Odoo databases
    5. More server configuration options
      1. Odoo server configuration files
      2. Changing the listening port
      3. Database selection options
      4. Managing server log messages
    6. Installing additional modules
      1. Finding community modules
      2. Configuring the add-ons path
    7. Installing Odoo in a Python virtual environment
      1. Downloading and installing add-on modules from PyPI
    8. The server development mode
    9. Summary
  9. Your First Odoo Application
    1. Technical requirements
    2. Overview of the library project
    3. Creating a new addon module
      1. Preparing the addons path
      2. Creating the module directory and manifest
      3. Adding an icon
      4. Choosing a license
      5. Installing a new module
      6. Upgrading modules
    4. Creating a new application
      1. Adding the app's top menu item
      2. Adding security groups
    5. Adding automated tests
      1. Testing business logic
      2. Testing access security
    6. The model layer
      1. Creating the data model
    7. Setting up access security
      1. Adding access control security
      2. Row-level access rules
    8. 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
    9. The business logic layer
      1. Adding business logic
    10. Web pages and controllers
    11. Summary
    12. Questions
    13. Further Reading
  10. Extending Modules
    1. Technical requirements
    2. Learning project – extending the Library app
    3. In-place Model extension
      1. Adding fields to a Model
      2. Modifying existing fields
    4. Modifying Views and data
      1. Extending Views
      2. Selecting extension points with XPath
      3. Modifying data
    5. More Model inheritance mechanisms
      1. Copying features with prototype inheritance
      2. Embedding Models using delegation inheritance
      3. Extending Models using mixin classes
    6. Extending Python methods
    7. Extending web controllers and templates
      1. Extending Web Controllers
      2. Extending QWeb Templates
    8. Summary
    9. Questions
    10. Further reading
  11. Import, Export, and Module Data
    1. Technical requirements
    2. Understanding the external identifier concept
      1. How external identifiers work
      2. Finding external identifiers
    3. Exporting and importing CSV data files
      1. Exporting data
      2. Importing data
      3. Related records in CSV data files
    4. Adding module data
      1. Demonstration data
    5. Using XML data files
      1. The noupdate data attribute
      2. Defining records in XML
        1. Setting field values directly
        2. Setting values using expressions
        3. Setting values on many-to-one relation fields
        4. Setting values on to-many relation fields
      3. Shortcuts for frequently used models
      4. Other actions in XML data files
        1. Deleting records
        2. Calling model methods
    6. Summary
    7. Questions
    8. Further reading
  12. Models – Structuring the Application Data
    1. Technical requirements
    2. Learning project – improving the Library app
    3. Creating models
      1. Model attributes
      2. Models and Python classes
      3. Transient and abstract models
      4. Inspecting existing models
    4. Creating fields
      1. Basic field types
      2. Common field attributes
      3. Special field names
    5. Relationships between models
      1. Many-to-one relationships
      2. One-to-many inverse relationships
      3. Many-to-many relationships
      4. Hierarchical relationships
      5. Flexible relationships using Reference fields
    6. Computed fields
      1. Searching and writing to computed fields
      2. Storing computed fields
      3. Related fields
    7. Model constraints
      1. SQL model constraints
      2. Python model constraints
    8. About the Odoo base Models
    9. Summary
  13. Recordsets – Working with Model Data
    1. Technical requirements
    2. Using the shell command
    3. The execution environment
      1. Environment attributes
      2. The environment context
      3. Modifying the recordset execution environment
    4. Querying data with recordsets and domains
      1. Creating recordsets
      2. Domain expressions
    5. Accessing data on recordsets
      1. Accessing data on records
      2. Accessing relational fields
      3. Accessing date and time values
      4. Converting text-represented dates and times
    6. Writing on records
      1. Writing with object-style value assignment
      2. Writing with the write() method
      3. Writing date and time values
      4. Creating and deleting records
    7. Composing recordsets
    8. Low-level SQL and database transactions
    9. Summary
  14. Business Logic – Supporting Business Processes
    1. Technical requirements
    2. Learning project – the library_checkout module
    3. Using stages for document-centered workflows
    4. The ORM method decorators
      1. Methods for recordsets – @api.multi
      2. Methods for singleton records – @api.one
      3. Class static methods – @api.model
      4. On change methods
      5. Other model method decorators
    5. Using the ORM built-in methods
      1. Methods for writing model data
      2. Methods for data import and export
      3. Methods to support the user interface
    6. The message and activity features
      1. Message subtypes
      2. Posting messages
      3. Adding followers
    7. Creating a wizard
      1. The wizard model
      2. The wizard form
      3. The wizard business logic
    8. Using log messages
    9. Raising exceptions
    10. Unit tests
      1. Adding unit tests
      2. Running tests
      3. Setting up tests
      4. Writing test cases
      5. Testing exceptions
    11. 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. Inspecting and killing running processes
    12. Summary
    13. Further reading
  15. External API – Integrating with Other Systems
    1. Technical requirements
    2. Learning project – a client to catalogue books
    3. Setting up Python on the client machine
    4. Connecting to Odoo API using XML-RPC
    5. Running server methods using XML-RPC
    6. Search and read API methods
    7. The Library client XML-RPC interface
    8. The Library client user interface
    9. Using the OdooRPC library
    10. About the ERPpeek client
    11. Summary
    12. Further reading
  16. Backend Views – Designing the User Interface
    1. Technical requirements
    2. Menu items
    3. Window Actions
    4. Form view structure
      1. Business document views
      2. The header
        1. Header buttons
        2. The stage pipeline
        3. Using states instead of stages
      3. The document sheet
      4. Title and subtitle
      5. Grouping the form content
      6. Tabbed notebooks
    5. Fields
      1. Labels for fields
      2. Field widgets
      3. Relational fields
    6. Buttons
      1. Smart buttons
    7. Dynamic view elements
      1. On-change events
      2. Dynamic attributes
    8. List views
    9. Search views
    10. Other view types
      1. Activity views
      2. Calendar views
      3. Pivot views
      4. Graph views
    11. Summary
    12. Further reading
  17. Kanban Views and Client-Side QWeb
    1. Technical requirements
    2. About Kanban boards
      1. Kanban views
    3. 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
    4. The QWeb template 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 dictionaries and lists
    5. Inheritance on Kanban views
    6. Custom CSS and JavaScript assets
    7. Summary
    8. Further reading
  18. Reports and Server-Side QWeb
    1. Technical requirements
    2. Installing wkhtmltopdf
    3. Creating business reports
    4. QWeb report templates
    5. Presenting data in reports
    6. Rendering images
    7. Report totals
    8. Defining paper formats
    9. Enabling language translation in reports
    10. Reports based on custom SQL
    11. Summary
    12. Further reading
  19. Creating Website Frontend Features
    1. Technical requirements
    2. Learning project – the Library self-service
    3. Our first web page
      1. Hello World using a QWeb template
      2. HelloCMS!
    4. Building websites
      1. Adding CSS and JavaScript assets
      2. The checkout-list controller
      3. The checkout QWeb template
      4. The checkout detail page
    5. Summary
    6. Further reading
  20. Deploying and Maintaining Production Instances
    1. Technical requirements
    2. Installing Odoo from source code
      1. Installing dependencies
      2. Preparing a dedicated system user
      3. Installing from the source code
      4. Setting up the configuration file
      5. Multiprocessing workers
    3. Setting up Odoo as a system service
      1. Creating a systemd service
      2. Creating an Upstart or sysvinit service
      3. Checking the Odoo service from the command line
    4. Setting up an nginx reverse proxy
    5. Configuring and enforcing HTTPS
      1. Creating a self-signed SSL certificate
      2. Configuring HTTPS access on nginx
      3. Caching static content
    6. Server and module updates
      1. Creating a staging environment
      2. Updating Odoo source code
    7. Summary
    8. Further reading
  21. Assessments
    1. Chapter 1
    2. Chapter 3
    3. Chapter 4
    4. Chapter 5
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
18.222.119.148