Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Odoo 14 Development Cookbook
Odoo 14 Development Cookbook

Odoo 14 Development Cookbook: Rapidly build, customize, and manage secure and efficient business apps using Odoo's latest features , Fourth Edition

Arrow left icon
Profile Icon Gajjar Profile Icon Daniel Reis Profile Icon Holger Brunn Profile Icon Fayolle
Arrow right icon
$79.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (7 Ratings)
Paperback Dec 2020 784 pages 4th Edition
eBook
$43.99 $63.99
Paperback
$79.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Gajjar Profile Icon Daniel Reis Profile Icon Holger Brunn Profile Icon Fayolle
Arrow right icon
$79.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (7 Ratings)
Paperback Dec 2020 784 pages 4th Edition
eBook
$43.99 $63.99
Paperback
$79.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$43.99 $63.99
Paperback
$79.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Odoo 14 Development Cookbook

Chapter 2: Managing Odoo Server Instances

In Chapter 1, Installing the Odoo Development Environment, we looked at how to set up an Odoo instance using only the standard core add-ons that are shipped with source. This chapter focuses on adding non-core or custom add-ons to an Odoo instance. In Odoo, you can load add-ons from multiple directories. In addition, it is recommended that you load your third-party add-ons or your own custom add-ons from separate folders to avoid conflicts with Odoo core modules. Even Odoo Enterprise Edition is a type of add-on directory, and you need to load this just like a normal add-ons directory.

In this chapter, we will cover the following recipes:

  • Configuring the add-ons path
  • Standardizing your instance directory layout
  • Installing and upgrading local add-on modules
  • Installing add-on modules from GitHub
  • Applying changes to add-ons
  • Applying and trying proposed pull requests

    About the terminology

    In this book, we will use the terms add-on or module or app or add-on module interchangeably. All of them refer to the Odoo app or Extension app that can be installed in Odoo from the user interface.

Configuring the add-ons path

With the help of the addons_path parameter, you can load your own add-on modules into Odoo. When Odoo initializes a new database, it will search for add-on modules within directories that have been provided in the addons_path configuration parameter. Odoo will search in these directories for the potential add-on module.

Directories listed in addons_path are expected to contain subdirectories, each of which is an add-on module. Following initialization of the database, you will be able to install modules that are given in these directories.

Getting ready

This recipe assumes that you have an instance ready with a configuration file generated, as described in the Storing the instance configuration in a file recipe in Chapter 1, Installing the Odoo Development Environment. Note that the source code of Odoo is available in ~/odoo-dev/odoo, and the configuration file in ~/odoo-dev/myodoo.cfg.

How to do it…

To add the ~/odoo-dev/local-addons directory to addons_path of the instance, perform the following steps:

  1. Edit the configuration file for your instance, that is, ~/odoo-dev/myodoo.cfg.
  2. Locate the line starting with addons_path=. By default, this should look like the following:
    addons_path = ~/odoo-dev/odoo/addons
  3. Modify the line by appending a comma, followed by the name of the directory you want to add to addons_path, as shown in the following code:
    addons_path = ~/odoo-dev/odoo/addons,~/odoo-dev/local-addons
  4. Restart your instance from the terminal:
    $ ~/odoo-dev/odoo/odoo-bin -c my-instance.cfg

How it works…

When Odoo is restarted, the configuration file is read. The value of the addons_path variable is expected to be a comma-separated list of directories. Relative paths are accepted, but they are relative to the current working directory and therefore should be avoided in the configuration file.

At this point, we have only listed the add-on directory in Odoo, but no add-on modules are present in ~/odoo-dev/local-addons. And even if you add a new add-on module to this directory, Odoo does not show this module in the user interface. For this, you need to perform an extra operation, as explained in the next recipe, Updating the add-on modules list.

Note

The reason behind this is that when you initialize a new database, Odoo automatically lists your custom modules in available modules, but if you add new modules following database initialization, then you need to manually update the list of available modules, as shown in the Updating the add-on modules list recipe.

There's more…

When you call the odoo-bin script for the first time to initialize a new database, you can pass the --addons-path command-line argument with a comma-separated list of directories. This will initialize the list of available add-on modules with all of the add-ons found in the supplied add-ons path. When you do this, you have to explicitly include the base add-ons directory (odoo/odoo/addons), as well as the core add-ons directory (odoo/addons). A small difference with the preceding recipe is that the local add-ons must not be empty; they must contain at least one sub-directory, which has the minimal structure of an add-on module.

In Chapter 3, Creating Odoo Add-On Modules, we will look at how to write your own modules. In the meantime, here's a quick hack to produce something that will make Odoo happy:

$ mkdir -p ~/odoo-dev/local-addons/dummy
$ touch ~/odoo-dev/local-addons/dummy/  init  .py
$ echo '{"name": "dummy", "installable": False}' > \
~/odoo-dev/local-addons/dummy/  manifest  .py

You can use the --save option to save the path to the configuration file:

$ odoo/odoo-bin -d mydatabase \
--add-ons-path="odoo/odoo/addons,odoo/addons,~/odoo-dev/local-addons"
\
--save -c ~/odoo-dev/my-instance.cfg --stop-after-init

In this case, using relative paths is OK, since they will be converted into absolute paths in the configuration file.

Note

Since Odoo only checks directories in the add-ons path for the presence of add-ons when the path is set from the command line, not when the path is loaded from a configuration file, the dummy module is no longer necessary. You may, therefore, remove it (or keep it until you're sure that you won't need to create a new configuration file).

Standardizing your instance directory layout

We recommend that your development and production environments all use a similar directory layout. This standardization will prove helpful when you have to perform maintenance operations, and it will also ease your day-to-day work.

This recipe creates a directory structure that groups files with similar life cycles or similar purposes in standardized subdirectories.

Note

This recipe is only useful if you want to manage similar folder structure development and production environments. If you do not want this, you can skip this recipe.

Also, it is not compulsory to observe the same folder structure as in this recipe. Feel free to alter this structure to suit your needs.

How to do it…

To create the proposed instance layout, you need to perform the following steps:

  1. Create one directory per instance:
    $ mkdir ~/odoo-dev/projectname
    $ cd ~/odoo-dev/projectname
  2. Create a Python virtualenv object in a subdirectory called env/:
    $ python3 -m venv env
  3. Create some subdirectories, as follows:
    $ mkdir src local bin filestore logs

    The functions of the subdirectories are as follows:

    • src/: This contains the clone of Odoo itself, as well as the various third-party add-on projects (we have added Odoo source code to the next step in this recipe).
    • local/: This is used to save your instance-specific add-ons.
    • bin/: This includes various helper executable shell scripts.
    • filestore/: This is used as a file store.
    • logs/ (optional): This is used to store the server log files.
  4. Clone Odoo and install the requirements (refer to Chapter 1, Installing the Odoo Development Environment, for details on this):
    $ git clone -b 14.0 --single-branch --depth 1 https://github.com/odoo/odoo.git src/odoo
    $ env/bin/pip3 install -r src/odoo/requirements.txt
  5. Save the following shell script as bin/odoo:
    #!/bin/sh ROOT=$(dirname $0)/..
    PYTHON=$ROOT/env/bin/python3 ODOO=$ROOT/src/odoo/odoo-bin
    $PYTHON $ODOO -c $ROOT/projectname.cfg "$@" exit $?
  6. Make the script executable:
    $ chmod +x bin/odoo
  7. Create an empty dummy local module:
    $ mkdir -p local/dummy
    $ touch local/dummy/  init  .py
    $ echo '{"name": "dummy", "installable": False}' >\ local/dummy/  manifest  .py
  8. Generate a configuration file for your instance:
    $ bin/odoo --stop-after-init --save \
    --addons-path src/odoo/odoo/addons,src/odoo/addons,local \
    --data-dir filestore
  9. Add a .gitignore file, which is used to tell GitHub to exclude given directories so that Git will ignore these directories when you commit the code, for example, filestore/, env/, logs/, and src/:
    # dotfiles, with exceptions:
    .*
    !.gitignore
    # python compiled files
    *.py[co]
    # emacs backup files
    *~
    # not tracked subdirectories
    /env/
    /src/
    /filestore/
    /logs/
  10. Create a Git repository for this instance and add the files you've added to Git:
    $ git init
    $ git add .
    $ git commit -m "initial version of projectname"

How it works…

We generate a clean directory structure with clearly labeled directories and dedicated roles. We are using different directories to store the following:

  • The code maintained by other people (in src/)
  • The local-specific code
  • filestore of the instance

By having one virtualenv environment per project, we are sure that the project's dependencies will not interfere with the dependencies of other projects that may be running a different version of Odoo or will use different third-party add-on modules, which require different versions of Python dependencies. This comes at the cost of a little disk space.

In a similar way, by using separate clones of Odoo and third-party add-on modules for our different projects, we are able to let each of these evolve independently and only install updates on the instances that need them, hence reducing the risk of introducing regressions.

The bin/odoo script allows us to run the server without having to remember the various paths or activate the virtualenv environment. This also sets the configuration file for us. You can add additional scripts in there to help you in your day-to-day work. For instance, you can add a script to check out the different third-party projects that you need to run your instance.

Regarding the configuration file, we have only demonstrated the bare minimum options to set up here, but you can obviously set up more, such as the database name, the database filter, or the port on which the project listens. Refer to Chapter 1, Installing the Odoo Development Environment, for more information on this topic.

Finally, by managing all of this in a Git repository, it becomes quite easy to replicate the setup on a different computer and share the development among a team.

Speedup tip

To facilitate project creation, you can create a template repository containing the empty structure, and fork that repository for each new project. This will save you from retyping the bin/odoo script, the .gitignore file, and any other template file you need (continuous integration configuration, README.md, ChangeLog, and so on).

There's more...

The development of complex modules requires various configuration options, which leads to updating the configuration file whenever you want to try any configuration option. Updating the configuration file frequently can be a headache, and to avoid this, an alternative way is to pass all configuration options from the command line, as follows:

  1. Activate virtualenv manually:
    $ source env/bin/activate
  2. Go to the Odoo source directory:
    $ cd src/odoo
  3. Run the server:
    ./odoo-bin --addons-path=addons,../../local -d test-14 -i account,sale,purchase --log-level=debug

In step 3, we passed a few configuration options directly from the command line. The first is --add-ons-path, which loads Odoo's core add-ons directory, addons, and your add-ons directory, local, in which you will put your own add-on modules. Option -d will use the test-14 database or create a new database if it isn't present. The -i option will install the account, sale, and purchase modules. Next, we passed the log-level option and increased the log level to debug so that it will display more information in the log.

Note

By using the command line, you can quickly change the configuration options. You can also see live logs in the terminal. For all available options, refer to Chapter 1, Installing the Odoo Development Environment, or use the --help command to view a list of all options and the description of each option.

Installing and upgrading local add-on modules

The core functionality of Odoo comes from its add-on modules. You have a wealth of add-ons available as part of Odoo itself, as well as add-on modules that you can download from the app store or that have been written by yourself.

In this recipe, we will demonstrate how to install and upgrade add-on modules through the web interface and from the command line.

The main benefits of using the command line for these operations include being able to act on more than one add-on at a time and having a clear view of the server logs as the installation or update progresses, which is very useful when in development mode or when scripting the installation of an instance.

Getting ready

Make sure that you have a running Odoo instance with its database initialized and the add-ons path properly set. In this recipe, we will install/upgrade a few add-on modules.

How to do it…

There are two possible methods to install or update add-ons—you can use the web interface or the command line.

From the web interface

To install a new add-on module in your database using the web interface, perform the following steps:

  1. Connect to the instance using the Administrator account and open the Apps menu:
    Figure 2.1 – List of Odoo apps

    Figure 2.1 – List of Odoo apps

  2. Use the search box to locate the add-on you want to install. Here are a few instructions to help you with this task:
    • Activate the Not Installed filter.
    • If you're looking for a specific functionality add-on rather than a broad functionality add-on, remove the Apps filter.
    • Type a part of the module name in the search box and use this as a Module filter.
    • You may find that using the list view gives something more readable.
  3. Click on the Install button under the module name in the card.

Note that some Odoo add-on modules have external Python dependencies. If Python dependencies are not installed in your system, then Odoo will abort the installation and it will show the following dialog:

Figure 2.2 – Warning for external library dependency

Figure 2.2 – Warning for external library dependency

To fix this, just install the relevant Python dependencies on your system.

To update a pre-installed module in your database, perform the following steps:

  1. Connect to the instance using the Administrator account.
  2. Open the Apps menu.
  3. Click on Apps:
    Figure 2.3 – Odoo apps list

    Figure 2.3 – Odoo apps list

  4. Use the search box to locate the add-on you want to install. Here are a few tips:
    • Activate the Installed filter.
    • If you're looking for a specific functionality add-on rather than a broad functionality add-on, remove the Apps filter.
    • Type a part of the add-on module name into the search box and then press Enter to use this as a Module filter. For example, type CRM and press Enter to search CRM apps.
    • You may find that using the list view gives you something more readable.
  5. Click on the three dots in the top right-corner of the card and click on the Upgrade option:
Figure 2.4 – Drop-down link for upgrading the module

Figure 2.4 – Drop-down link for upgrading the module

Activate developer mode to see the technical name of the module. See Chapter 1, Installing the Odoo Development Environment, if you don't know how to activate developer mode:

Figure 2.5 – Application's technical names

Figure 2.5 – Application's technical names

After activating developer mode, it will show the module's technical name in red. If you are using Odoo Community Edition, you will see some extra apps with the Upgrade button. Those apps are Odoo Enterprise Edition apps, and in order to install/use them, you need to purchase a license.

From the command line

To install new add-ons in your database, perform the following steps:

  1. Find the names of the add-ons. This is the name of the directory containing the _manifest_.py file, without the leading path.
  2. Stop the instance. If you are working on a production database, make a backup.
  3. Run the following command:
    $ odoo/odoo-bin -c instance.cfg -d dbname -i addon1,addon2 \
    --stop-after-init

    You may omit -d dbname if this is set in your configuration file.

  4. Restart the instance.

To update an already installed add-on module in your database, perform the following steps:

  1. Find the name of the add-on module to update; this is the name of the directory containing the _manifest_.py file, without the leading path.
  2. Stop the instance. If you are working on a production database, make a backup.
  3. Run the following command:
    $ odoo/odoo-bin -c instance.cfg -d dbname -u addon1 \
    --stop-after-init

    You may omit -d dbname if this is set in your configuration file.

  4. Restart the instance.

How it works…

The add-on module installation and update are two closely related processes, but there are some important differences, as highlighted in the following two sections.

Add-on installation

When you install an add-on, Odoo checks its list of available add-ons for an uninstalled add-on with the supplied name. It also checks for the dependencies of that add-on and, if there are any, it will recursively install them before installing the add-on.

The installation process of a single module consists of the following steps:

  1. If there are any, run the add-on preinit hook.
  2. Load the model definitions from the Python source code and update the database structure, if necessary (refer to Chapter 4, Application Models, for details).
  3. Load the data files of the add-on and update the database contents, if necessary (refer to Chapter 6, Managing Module Data, for details).
  4. Install the add-on demo data if demo data has been enabled in the instance.
  5. If there are any, run the add-on postinit hook.
  6. Run a validation of the view definitions of the add-on.
  7. If demo data is enabled and a test is enabled, run the tests of the add-on (refer to Chapter 18, Automated Test Cases, for details).
  8. Update the module state in the database.
  9. Update the translations in the database from the add-on's translations (refer to Chapter 11, Internationalization, for details).

    Note

    The preinit and postinit hooks are defined in the _manifest_.py file using the pre_init_hook and post_init_hook keys, respectively. These hooks are used to invoke Python functions before and after the installation of an add-on module. To learn more about init hooks, refer to Chapter 3, Creating Odoo Add-On Modules.

Add-on update

When you update an add-on, Odoo checks in its list of available add-on modules for an installed add-on with the given name. It also checks for the reverse dependencies of that add-on (these are the add-ons that depend on the updated add-on). If any, it will recursively update them, too.

The update process of a single add-on module consists of the following steps:

  1. Run the add-on module's pre-migration steps, if any (refer to Chapter 6, Managing Module Data, for details).
  2. Load the model definitions from the Python source code and update the database structure if necessary (refer to Chapter 4, Application Models, for details).
  3. Load the data files of the add-on and update the database's contents if necessary (refer to Chapter 6, Managing Module Data, for details).
  4. Update the add-on's demo data if demo data is enabled in the instance.
  5. If your module has any migration methods, run the add-on post-migration steps (refer to Chapter 6, Managing Module Data, for details).
  6. Run a validation of the view definitions of the add-on.
  7. If demo data is enabled and a test is enabled, run the tests of the add-on (refer to Chapter 18, Automated Test Cases, for details).
  8. Update the module state in the database.
  9. Update the translations in the database from the add-on's translations (refer to Chapter 11, Internationalization, for details).

    Note

    Note that updating an add-on module that is not installed does nothing at all. However, installing an add-on module that is already installed reinstalls the add-on, which can have some unintended effects with some data files that contain data that is supposed to be updated by the user and not updated during the normal module update process (refer to the Using the noupdate and forcecreate flags recipe in Chapter 6, Managing Module Data). There is no risk of error from the user interface, but this can happen from the command line.

There's more…

Be careful with dependency handling. Consider an instance where you want to have the sale, sale_stock, and sale_specific add-ons installed, with sale_specific depending on sale_stock, and sale_stock depending on sale. To install all three, you only need to install sale_specific, as it will recursively install the sale_stock and sale dependencies. To update all three, you need to update sale, as this will recursively update the reverse dependencies, sale_stock and sale_specific.

Another tricky part with managing dependencies is when you add a dependency to an add-on that already has a version installed. Let's understand this by continuing with the previous example. Imagine that you add a dependency on stock_dropshipping in sale_specific. Updating the sale_specific add-on will not automatically install the new dependency, and neither will requesting the installation of sale_specific. In this situation, you can get very nasty error messages because the Python code of the add-on is not successfully loaded, but the data of the add-on and the models' tables in the database are present. To resolve this, you need to stop the instance and manually install the new dependency.

Installing add-on modules from GitHub

GitHub is a great source of third-party add-ons. A lot of Odoo partners use GitHub to share the add-ons they maintain internally, and the Odoo Community Association (OCA) collectively maintains several hundred add-ons on GitHub. Before you start writing your own add-on, ensure that you check that nothing already exists that you can use as is or as a starting point.

This recipe will show you how to clone the partner-contact project of the OCA from GitHub and make the add-on modules it contains available in your instance.

Getting ready

Suppose you want to add new fields to the customers (partner) form. By default, the Odoo customers model doesn't have a gender field. If you want to add a gender field, you need to create a new module. Fortunately, someone on a mailing list tells you about the partner_contact_gender add-on module, which is maintained by the OCA as part of the partner-contact project.

The paths that are used in this recipe reflect the layout that was proposed in the Standardizing your instance directory layout recipe.

How to do it…

To install partner_contact_gender, perform the following steps:

  1. Go to your project's directory:
    $ cd ~/odoo-dev/my-odoo/src
  2. Clone the 14.0 branch of the partner-contact project in the src/ directory:
    $ git clone --branch 14.0 \
    https://github.com/OCA/partner-contact.git src/partner-contact
  3. Change the add-ons path to include that directory and update the add-ons list of your instance (refer to the Configuring the add-ons path recipe and Updating the add-on modules list recipes in this chapter). The add-ons_path line of instance.cfg should look like this:
    addons_path = ~/odoo-dev/my-odoo/src/odoo/odoo/addons, \
    ~/odoo-dev/my-odoo/src/odoo/addons, \
    ~/odoo-dev/my-odoo/src/, \
    ~/odoo-dev/local-addons
  4. Install the partner_contact_gender add-on (if you don't know how to install the module, take a look at the previous recipe, Installing and upgrading local add-on modules).

How it works…

All of the Odoo Community Association code repositories have their add-ons contained in separate subdirectories, which is coherent in accordance with what is expected by Odoo regarding the directories in the add-ons path. Consequently, just cloning the repository somewhere and adding that location in the add-ons path is enough.

There's more…

Some maintainers follow a different approach and have one add-on module per repository, living at the root of the repository. In that case, you need to create a new directory, which you will add to the add-ons path and clone all of the add-ons from the maintainer you need in this directory. Remember to update the add-on modules list each time you add a new repository clone.

Applying changes to add-ons

Most add-ons that are available on GitHub are subject to change and do not follow the rules that Odoo enforces for its stable release. They may receive bug fixes or enhancements, including issues or feature requests that you have submitted, and these changes may introduce database schema changes or updates in the data files and views. This recipe explains how to install the updated versions.

Getting ready

Suppose you reported an issue with partner_contact_gender and received a notification that the issue was solved in the last revision of the 14.0 branch of the partner-contact project. In this case, you will want to update your instance with this latest version.

How to do it…

To apply a source modification to your add-on from GitHub, you need to perform the following steps:

  1. Stop the instance using that add-on.
  2. Make a backup if it is a production instance (refer to the Manage Odoo server databases recipe in Chapter 1, Installing the Odoo Development Environment).
  3. Go to the directory where partner-contact was cloned:
    $ cd ~/odoo-dev/my-odoo/src/partner-contact
  4. Create a local tag for the project so that you can revert to that version in case things break:
    $ git checkout 14.0
    $ git tag 14.0-before-update-$(date --iso)
  5. Get the latest version of the source code:
    $ git pull --ff-only
  6. Update the partner_address_street3 add-on in your databases (refer to the Installing and upgrading local add-on modules recipe).
  7. Restart the instance.

How it works…

Usually, the developer of the add-on module occasionally releases the newest version of the add-on. This update typically contains bug fixes and new features. Here, we will get a new version of the add-on and update it in our instances.

If git pull --ff-only fails, you can revert to the previous version using the following command:

$ git reset --hard 14.0-before-update-$(date --iso)

Then, you can try git pull (without --ff-only), which will cause a merge, but this means that you have local changes on the add-on.

See also

If the update step breaks, refer to the Updating Odoo from Source recipe in Chapter 1, Installing the Odoo Development Environment, for recovery instructions. Remember to always test an update on a copy of a database production first.

Applying and trying proposed pull requests

In the GitHub world, a Pull Request (PR) is a request that's made by a developer so that the maintainers of a project can include some new developments. Such a PR may contain a bug fix or a new feature. These requests are reviewed and tested before being pulled into the main branch.

This recipe explains how to apply a PR to your Odoo project in order to test an improvement or a bug fix.

Getting ready

As in the previous recipe, suppose you reported an issue with partner_address_street3 and received a notification that the issue was solved in a PR, which hasn't been merged in the 14.0 branch of the project. The developer asks you to validate the fix in PR #123. You need to update a test instance with this branch.

You should not try out such branches directly on a production database, so first create a test environment with a copy of the production database (refer to Chapter 1, Installing the Odoo Development Environment).

How to do it…

To apply and try out a GitHub PR for an add-on, you need to perform the following steps:

  1. Stop the instance.
  2. Go to the directory where partner-contact was cloned:
    $ cd ~/odoo-dev/my-odoo/src/partner-contact
  3. Create a local tag for the project so that you can revert to that version in case things break:
    $ git checkout 14.0
    $ git tag 14.0-before-update-$(date --iso)
  4. Pull the branch of the pull request. The easiest way to do this is by using the number of the PR, which should have been communicated to you by the developer. In our example, this is PR number 123:
    $ git pull origin pull/123/head
  5. Update the partner_contact_gender1 add-on module in your database and restart the instance (refer to the Installing and upgrading local add-on modules recipe if you don't know how to update the module).
  6. Test the update—try to reproduce your issue, or try out the feature you wanted.

If this doesn't work, comment on the PR page of GitHub, explaining what you did and what didn't work so that the developer can update the PR.

If it works, say so on the PR page too; this is an essential part of the PR validation process, and it will speed up merging in the main branch.

How it works…

We are using a GitHub feature that enables pull requests to be pulled by number using the pull/nnnn/head branch name, where nnnn is the number of the PR. The Git pull command will merge the remote branch in ours, applying the changes in our code base. After this, we update the add-on module, test it, and report back to the author of the change with regard to any failures or success.

There's more…

You can repeat step 4 of this recipe for different pull requests in the same repository if you want to test them simultaneously. If you are really happy with the result, you can create a branch to keep a reference to the result of the applied changes:

$ git checkout -b 14.0-custom

Using a different branch will help you remember that you are not using the version from GitHub, but a custom one.

Note

The git branch command can be used to list all of the local branches you have in your repository.

From then on, if you need to apply the latest revision of the 14.0 branch from GitHub, you will need to pull it without using --ff-only:

$ git pull origin 14.0
Left arrow icon Right arrow icon
Download code icon Download Code

Description

With its latest iteration, the powerful Odoo framework released a wide variety of features for rapid application development. This updated Odoo development cookbook will help you explore the new features in Odoo 14 and learn how to use them to develop Odoo applications from scratch. You'll learn about the new website concepts in Odoo 14 and get a glimpse of Odoo's new web-client framework, the Odoo Web Library (OWL). Once you've completed the installation, you'll begin to explore the Odoo framework with real-world examples. You'll then create a new Odoo module from the ground up and progress to advanced framework concepts. You'll also learn how to modify existing applications, including Point of Sale (POS) applications. This book isn't just limited to backend development; you'll discover advanced JavaScript recipes for creating new views and widgets. As you progress, you'll learn about website development and become a quality Odoo developer by studying performance optimization, debugging, and automated testing. Finally, you'll delve into advanced concepts such as multi-website, In-App Purchasing (IAP), Odoo.sh, the IoT Box, and security. By the end of the book, you'll have all the knowledge you need to build impressive Odoo applications and you'll be well versed in development best practices that will come in handy when working with the Odoo framework.

What you will learn

  • Build beautiful websites with Odoo CMS using dynamic building blocks
  • Get to grips with advanced concepts such as caching, prefetching, debugging
  • Modify backend JavaScript components and POS applications with the new OWL framework
  • Connect and access any object in Odoo via Remote Procedure Calls (RPC)
  • Manage, deploy, and test an Odoo instance with Odoo.sh
  • Configure IoT Box to add and upgrade Point of Sale (POS) hardware
  • Find out how to implement in-app purchase services
Estimated delivery fee Deliver to Malaysia

Standard delivery 10 - 13 business days

$8.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 24, 2020
Length: 784 pages
Edition : 4th
Language : English
ISBN-13 : 9781800200319
Vendor :
Odoo S.A
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Malaysia

Standard delivery 10 - 13 business days

$8.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

Product Details

Publication date : Dec 24, 2020
Length: 784 pages
Edition : 4th
Language : English
ISBN-13 : 9781800200319
Vendor :
Odoo S.A
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 170.97
Odoo 14 Development Cookbook
$79.99
Designing Professional Websites with Odoo Website Builder
$43.99
Odoo 15 Development Essentials
$46.99
Total $ 170.97 Stars icon
Banner background image

Table of Contents

25 Chapters
Chapter 1: Installing the Odoo Development Environment Chevron down icon Chevron up icon
Chapter 2: Managing Odoo Server Instances Chevron down icon Chevron up icon
Chapter 3: Creating Odoo Add-On Modules Chevron down icon Chevron up icon
Chapter 4: Application Models Chevron down icon Chevron up icon
Chapter 5: Basic Server-Side Development Chevron down icon Chevron up icon
Chapter 6: Managing Module Data Chevron down icon Chevron up icon
Chapter 7: Debugging Modules Chevron down icon Chevron up icon
Chapter 8: Advanced Server-Side Development Techniques Chevron down icon Chevron up icon
Chapter 9: Backend Views Chevron down icon Chevron up icon
Chapter 10: Security Access Chevron down icon Chevron up icon
Chapter 11: Internationalization Chevron down icon Chevron up icon
Chapter 12: Automation, Workflows, Emails, and Printing Chevron down icon Chevron up icon
Chapter 13: Web Server Development Chevron down icon Chevron up icon
Chapter 14: CMS Website Development Chevron down icon Chevron up icon
Chapter 15: Web Client Development Chevron down icon Chevron up icon
Chapter 16: The Odoo Web Library (OWL) Chevron down icon Chevron up icon
Chapter 17: In-App Purchasing with Odoo Chevron down icon Chevron up icon
Chapter 18: Automated Test Cases Chevron down icon Chevron up icon
Chapter 19: Managing, Deploying, and Testing with Odoo.sh Chevron down icon Chevron up icon
Chapter 20: Remote Procedure Calls in Odoo Chevron down icon Chevron up icon
Chapter 21: Performance Optimization Chevron down icon Chevron up icon
Chapter 22: Point of Sale Chevron down icon Chevron up icon
Chapter 23: Managing Emails in Odoo Chevron down icon Chevron up icon
Chapter 24: Managing the IoT Box Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(7 Ratings)
5 star 71.4%
4 star 0%
3 star 14.3%
2 star 14.3%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




N/A Jan 24, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Feefo Verified review Feefo
Eric Vernichon Oct 17, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Feefo Verified review Feefo
Shambazov Jan 05, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
There is an obvious shortage of books on CRM systems. This is sad, because in our days the CRM market has been experiencing shocks and new players are emerging. In particular, there is a lack of books devoted to Odoo, so for example Odoo 13 was left without attention of major publishers. For this reason, the release of a new book is already an event.I have been waiting for this book for a long time and with impatience. As expected, it contains a lot of useful information. The quality of the selection of the material shows that the authors are practicing professionals and shared the solution to those issues that they themselves faced. The book is full of healthy recipes.Below I will write what thoughts I had while studying the book:Good thing there is a section on sitemaps.In section 9 - Backend views, it would be nice to add more illustrations of how the various views looks. This would help to choose the right one. For example, fig. 9.3 was a revelation for me, I did not know that this could be done.I was especially pleased with the recipe for redirecting old URLs. This must be paid attention to if you are creating a site on Odoo instead of an existing one, in order to exclude a failure in SEO.Another interesting recipe is "Generating videos / screenshots for failed test cases". Such an idea would not have occurred to me!The section on performance optimization is qute interesting. Basically, Odoo is fast enough even on weak machines. Before I used to use Nginx tools to further speed up Odoo.My wishes for the publishing house:Unfortunately, in the electronic version of the book, tables are presented as images. The problem is search doesn't work inside images and it can be difficult to find what readers needs.Another problem of the electronic version is that sometimes you come across unnecessary spaces in the command lines (for example, page 62), so you need to be careful when copying them from the book.Overall, the book is certainly useful and I will keep the book handy in my daily work.Who should I recommend this book to - someone who already knows the basics of working in Odoo. For beginners, I would advise you to wait until "Odoo 14 Development Essentials" is released. Cookbooks are not intended for beginners, they are a collection of recipes for solving practical problems. Moreover, it is intended specifically for developers. If you only use standard functionality, then much of the valuable information in this book will not be so useful to you.I look forward to the release of Odoo 14 Development Essentials.Thanks to Pack publishing for regularly publishing books about Odoo.
Amazon Verified review Amazon
Ray Carnes Jan 05, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
What I liked:Scope - the technical topics covered are the ones most developers will want to know about.Detail - lots of explanatory text and examples.Examples - you can develop your own module and access a GitHub repository to check your workAuthors - Daniel, Holger and Alexandre are well known and long time Community members so you are hearing from expertsWhat I didn't:Terms - some are not explained until AFTER they are introduced and this might trip up less knowledgeable DevOps folksWhy - the why behind the best practices isn't always explained - some may find this leaves them needing to research a topic in more detail on their ownScreenshots - when covering Backend Views there could be a lot more to convey how these workMobile - basically not coveredUp to Date - multi_edit is not covered (new at v14) so readers might want to review other resources to check they are fully up to date with what is available in this version.Still highly recommend the book!
Amazon Verified review Amazon
Cliente Amazon May 25, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
para poder realizar con efectividad y rapidez mi teletrabajo
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela