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 Development Cookbook
Odoo Development Cookbook

Odoo Development Cookbook: Build effective business applications using the latest features in Odoo 17 , Fifth Edition

Arrow left icon
Profile Icon Daudi Profile Icon Daniel Reis Profile Icon Holger Brunn Profile Icon Fayolle Profile Icon Gajjar Profile Icon Vora +2 more Show less
Arrow right icon
€37.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (10 Ratings)
Paperback May 2024 774 pages 5th Edition
eBook
€20.98 €29.99
Paperback
€37.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Daudi Profile Icon Daniel Reis Profile Icon Holger Brunn Profile Icon Fayolle Profile Icon Gajjar Profile Icon Vora +2 more Show less
Arrow right icon
€37.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (10 Ratings)
Paperback May 2024 774 pages 5th Edition
eBook
€20.98 €29.99
Paperback
€37.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€20.98 €29.99
Paperback
€37.99
Subscription
Free Trial
Renews at €18.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
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 Development Cookbook

Installing the Odoo Development Environment

To begin our Odoo development journey, we must set up our development environment by installing Odoo using source code that we can use to enhance, debug, and improve our development skills. There are several ways to set up an Odoo development environment, but this chapter proposes the best of them. You will find several other tutorials on the web explaining the other approaches. Keep in mind that this chapter is about setting up a development environment that has different requirements from a production environment; production has different parameters we must set in the config file, as per the volume of data and number of users in the system. We will cover configuration file parameters and their usage in this chapter.

If you are new to Odoo development, you must know about certain aspects of the Odoo ecosystem. The first recipe will give you a brief introduction to the Odoo ecosystem, after which we will install Odoo for development purposes.

In this chapter, we will cover the following recipes:

  • Understanding the Odoo ecosystem
  • Installing Odoo from the source
  • Managing Odoo server databases
  • Storing the instance configuration in a file
  • Activating Odoo developer tools
  • Updating the add-on modules list

Technical requirements

All the code that’s used in this chapter can be downloaded from this book’s GitHub repository at https://github.com/PacktPublishing/Odoo-17-Development-Cookbook-Fifth-Edition/tree/main/Chapter01.

Understanding the Odoo ecosystem

Odoo provides developers with out-of-the-box modularity and its powerful framework helps them build projects quickly. There are various characters in the Odoo ecosystem that you should be familiar with before embarking on your journey of becoming a successful Odoo developer.

Let’s assume you have a system with 4 CPU cores, 8 GB of RAM, and 30 concurrent Odoo users.

To determine the number of workers needed, divide the number of users by 6. In this case, 30 users divided by 6 equals 5, which is the theoretical number of workers required.

To calculate the theoretical maximum number of workers, multiply the number of CPU cores by 2 and add 1. For 4 CPU cores, (4 * 2) + 1 equals 9, which is the theoretical maximum number of workers.

Based on these calculations, you can use 5 workers for the Odoo users and an additional worker for the cron worker, making a total of 6 workers.

To estimate the RAM consumption, use the following formula:

RAM = Number of workers * ((0.8 * 150) + (0.2 * 1024))

In this case, 6 workers multiplied by ((0.8 * 150) + (0.2 * 1024)) equals approximately 2 GB of RAM.

Therefore, based on these calculations, the Odoo installation will require around 2 GB of RAM.

Odoo editions

Odoo comes in two different editions. The first one is Community Edition, which is open source, while the second one is Enterprise Edition, which has licensing fees. Unlike other software vendors, Odoo Enterprise Edition is just a pack of extra applications that adds extra features or new apps to the Community Edition. The Enterprise Edition runs on top of the Community Edition. The Community Edition comes under the Lesser General Public License v3.0 (LGPLv3) and comes with all of the basic enterprise resource planning (ERP) applications, such as sales, customer relationship management (CRM), invoicing, purchases, and a website builder. Alternatively, the Enterprise Edition comes with the Odoo Enterprise Edition license, which is a proprietary license. Odoo Enterprise Edition has several advanced features, such as full accounting, studio, Voice over Internet Protocol (VoIP), mobile responsive design, e-sign, marketing automation, delivery and banking integrations, Internet of Things (IoT), and more. The Enterprise Edition also provides you with unlimited bugfix support. The following diagram shows that the Enterprise Edition depends on the Community Edition, which is why you need the latter to use the former:

Figure 1.1 – Differences between the Community Edition and Enterprise Edition

Figure 1.1 – Differences between the Community Edition and Enterprise Edition

You can find a full comparison of both editions here: https://www.odoo.com/page/editions.

Note

Odoo has the largest number of community developers among all open source ERPs on the market with 20K+ forks on GitHub, hence why you will find a large number of third-party apps (modules) on the app store. Some of the free apps use an Affero General Public License version 3 (AGPLv3). You cannot use the proprietary license on your app if your application has dependencies on such apps. Apps with an Odoo proprietary license can only be developed on modules that have LGPL or other proprietary licenses.

Git repositories

The entire code base of Odoo is hosted on GitHub. You can post bugs/issues for stable versions here. You can also propose a new feature by submitting a pull request (PR). There are several repositories in Odoo. See the following table for more information:

Repositories

Purpose

https://github.com/odoo/odoo

This is the Community Edition of Odoo. It’s available publicly.

https://github.com/odoo/enterprise

This is the Enterprise Edition of Odoo. It’s available to official Odoo partners only.

https://github.com/odoo-dev/odoo

This is an ongoing development repository. It’s available publicly.

Table 1.1 – Odoo git repositories

Every year, Odoo releases a major release, which is a long-term support version that will last for 3 years, and a few minor versions. Minor versions are mostly used in Odoo’s online Software-as-a-Service (SaaS) offering, meaning that Odoo SaaS users get early access to these features. Major version branches have names such as 17.0, 16.0, 15.0, 14.0, 13.0, and 12.0, while minor version branches have names such as saas-17.1 and saas-17.2 on GitHub. These minor versions are mostly used for Odoo’s SaaS platform. The master branch is under development and is unstable, so it is advisable not to use this for production since it might break your database.

Runbot

Runbot is Odoo’s automated testing environment. Whenever there is a new commit in Odoo’s GitHub branch, Runbot pulls those latest changes and creates the builds for the last four commits. Here, you can test all stable and in-development branches. You can even play with the Enterprise Edition and its development branches.

Every build has a different background color, which indicates the status of the test cases. A green background color means that all of the test cases run successfully and you can test that branch, while a red background color means that some test cases have failed on this branch and some features might be broken on that build. You can view the logs for all test cases, which show exactly what happens during installation. Every build has two databases. The all database has all of the modules installed on it, while the base database only has base Odoo modules installed. Every build is installed with basic demo data, so you can test it quickly without extra configurations.

Note

You can access Runbot at http://runbot.odoo.com/runbot.

The following credentials can be used to access any Runbot build:

  • Login ID: admin Password: admin
  • Login ID: demo Password: demo
  • Login ID: portal Password: portal

Note

This is a public testing environment, so other users might be using/testing the same branch that you are testing.

Odoo app store

Odoo launched the app store a few years back, and it was an instant hit. At the time of writing, over 39,000+ different apps are hosted there. You will find lots of free and paid applications for different versions here. This includes specific solutions for different business verticals, such as education, food industries, and medicine. It also includes apps that extend or add new features to existing Odoo applications. The app store also provides numerous beautiful themes for the Odoo website builder. In Chapter 3, Creating Odoo Add-On Modules, you will learn how to set pricing and currency for your custom module.

You can access the Odoo app store by going to https://www.odoo.com/apps.

You can access Odoo’s themes by going to https://www.odoo.com/apps/themes.

Note

Odoo has open sourced several themes after version 13 and now works with an advanced JavaScript called OWL. We will cover this in Chapter 16. Note that these were paid themes in previous versions. This means that, in Odoo versions 15 and 16, you can download and use those beautiful themes at no extra cost.

Odoo Community Association

Odoo Community Association (OCA) is a non-profit organization that develops/manages community-based Odoo modules. All OCA modules are open source and maintained by Odoo community members. OCA’s GitHub account contains multiple repositories for different Odoo applications. Apart from Odoo modules, it also contains various tools, a migration library, accounting localizations, and so on.

Here is the URL for OCA’s official GitHub account: https://github.com/OCA.

Official Odoo help forum

Odoo has a very powerful framework, and tons of things can be achieved just by using/activating options or by following specific patterns. Consequently, if you run into some technical issues or if you are not sure about some complex cases, then you can post your query on Odoo’s official help forum. Lots of developers are active on this forum, including some official Odoo employees.

You can search for questions or post your new questions by going to https://www.odoo.com/forum/help-1.

Odoo’s eLearning platform

Recently, Odoo has launched a new eLearning platform. This platform provides lots of videos that explain how to use different Odoo applications. At the time of writing, this platform does not have technical videos, just functional ones.

Here is the URL for Odoo’s eLearning platform: https://www.odoo.com/slides.

Installing Odoo from the source

It is highly recommended that you use the Linux Ubuntu operating system to install Odoo since this is the operating system that Odoo uses for all its tests, debugging, and installations of Odoo Enterprise. Additionally, most Odoo developers use GNU/Linux distributions, so they are much more likely to get support from the Odoo community for operating system-level issues that occur in GNU/Linux than Windows or macOS.

It is also recommended to develop Odoo add-on modules using the same environment (the same distribution and the same version) as the one that will be used in production. This will avoid nasty surprises, such as discovering on the day of deployment that a library has a different version than expected, with a slightly different and incompatible behavior. If your workstation is using a different operating system, a good approach is to set up a virtual machine (VM) on your workstation and install a GNU/Linux distribution in the VM.

Note

Ubuntu is available as an app in the Microsoft Store, so you can use that if you don’t want to switch to Ubuntu.

For this book, we will be using Ubuntu Server 22.04 LTS, but you can use any other Debian GNU/Linux operating system. Whatever Linux distribution you choose, you should have some notion of how to use it from the command line, and knowing about system administration will certainly not do any harm.

Getting ready

We are assuming that you have Ubuntu 22.04 up and running and that you have an account with root access or that sudo has been configured. In the following sections, we will install Odoo’s dependencies and download Odoo’s source code from GitHub.

Note

Some of the configurations require a system login username, so we will use $(whoami) whenever a login username is required in a command line. This is a shell command that will substitute your login in the command you are typing.

Some operations will be easier if you have a GitHub account. If you don’t have one already, go to https://github.com and create one.

How to do it...

To install Odoo from the source, perform the following steps:

  1. Run the following commands to install the main dependencies:
    $ sudo apt-get update
    $ sudo apt install openssh-server fail2ban python3-pip python3-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libpq-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev git curl python3-venv python3.10-venv fontconfig libxrender1 xfonts-75dpi xfonts-base -y
  2. Download and install wkhtmltopdf:
    $ wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
    $ sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb

    If you encounter any errors after running the previous command, force install the dependencies with the following command:

    $ sudo apt-get install -f
  3. Now, install the PostgreSQL database:
    $ sudo apt install postgresql -y
  4. Configure PostgreSQL:
    $ sudo -i -u postgres createuser -s  $(whoami)
    $ sudo su postgres
    $ psql
    alter user $(whoami) with password 'your_password';
    \q
    exit
  5. Configure git:
    $ git config --global user.name "Your Name"
    $ git config --global user.email [email protected]
  6. Clone the Odoo code base:
    $ mkdir ~/odoo-dev
    $ cd ~/odoo-dev
    $ git clone -b 17.0 --single-branch --depth 1 https://github.com/odoo/odoo.git
  7. Create an odoo-17.0 virtual environment and activate it:
    $ python3 -m venv ~/venv-odoo-17.0
    $ source ~/venv-odoo-17.0/bin/activate
  8. Install the Python dependencies of Odoo in venv:
    $ cd ~/odoo-dev/odoo/
    $ pip3 install -r requirements.txt
  9. Create and start your first Odoo instances:
    $ createdb odoo-test
    $ python3 odoo-bin -d odoo-test -i base --addons-path=addons --db-filter=odoo-test$
  10. Point your browser to http://localhost:8069 and authenticate it by using the admin account and using admin as the password.

Note

If you need RTL support, please install node and rtlcss by running sudo apt-get install nodejs npm -y sudo npm install -g rtlcss.

How it works...

In step 1, we installed several core dependencies. These dependencies include various tools, such as git, pip3, wget, Python setup tools, and more. These core tools will help us install other Odoo dependencies using simple commands.

In step 2, we downloaded and installed the wkhtmltopdf package, which is used in Odoo to print PDF documents such as sale orders, invoices, and other reports. Odoo 17.0 needs version 0.12.6.1 of wkhtmltopdf, and that exact version might be not included in the current Linux distributions. Fortunately for us, the maintainers of wkhtmltopdf provide pre-built packages for various distributions at http://wkhtmltopdf.org/downloads.html and we have downloaded and installed it from that URL.

After this, we configured PostgreSQL, which is used for Odoo’s database management.

PostgreSQL configuration

In step 3, we installed the PostgreSQL database.

In step 4, we created a new database user with the login name of our system. $(whoami) is used to fetch your login name, and the -s option is used to give superuser rights. Let’s see why we need these configurations.

Odoo uses the psycopg2 Python library to connect with a PostgreSQL database. To access a PostgreSQL database with the psycopg2 library, Odoo uses the following values by default:

  • By default, psycopg2 tries to connect to a database with the same username as the current user on local connections, which enables password-less authentication (this is good for the development environment)
  • The local connection uses Unix domain sockets
  • The database server listens on port 5432

That’s it! Your PostgreSQL database is now ready to be connected with Odoo.

As this is a development server, we have given --superuser rights to the user. It is OK to give the PostgreSQL user more rights as this will be your development instance. For a production instance, you can use the --createdb command line instead of --superuser to restrict rights. The –superuser rights in a production server will give additional leverage to an attacker exploiting a vulnerability in some part of the deployed code.

If you want to use a database user with a different login, you will need to provide a password for the user. This is done by passing the --pwprompt flag on the command line when creating the user, in which case the command will prompt you for the password.

If the user has already been created and you want to set a password (or modify a forgotten password), you can use the following command:

$ psql -c "alter role $(whoami) with password 'newpassword'"

If this command fails with an error message saying that the database does not exist, it is because you did not create a database named after your login name in step 4 of this recipe. That’s fine; just add the --dbname option with an existing database name, such as --dbname template1.

Git configuration

For the development environment, we are using Odoo sourced from GitHub. With git, you can easily switch between different Odoo versions. Note that you can fetch the latest changes with the git pull command.

In step 5, we configured our git user.

In step 6, we downloaded the source code from Odoo’s official GitHub repository. We used the git clone command to download Odoo’s source code. We used a single branch as we only wanted a branch for the 17.0 version. We also used --depth 1 to avoid downloading the full commit history of the branch. These options will download the source code very quickly, but if you want, you can omit those options.

Odoo developers also propose nightly builds, which are available as tarballs and distribution packages. The main advantage of using git clone is that you will be able to update your repository when new bug fixes are committed in the source tree. You will also be able to easily test any proposed fixes and track regressions so that you can make your bug reports more precise and helpful for developers.

Note

If you have access to the Enterprise Edition source code, you can download that in a separate folder under the ~/odoo-dev directory.

Virtual environments

Python virtual environments, or venvs for short, are isolated Python workspaces. These are very useful to Python developers because they allow different workspaces with different versions of various Python libraries to be installed, possibly on different Python interpreter versions.

You can create as many environments as you wish using the python3 -m venv ~/newvenv command. This will create a newvenv directory in the specified location, containing a bin/ subdirectory and a lib/python3.10 subdirectory.

In step 7, we created a new virtual environment in the ~/venv-odoo-17.0 directory. This will be our isolated Python environment for Odoo, and all of Odoo’s Python dependencies will be installed in this environment.

To activate the virtual environment, we need to use the source command. We used the source ~/venv-odoo-17.0/bin/activate command to activate the virtual environment.

Installing Python packages

Odoo’s source code has a list of Python dependencies in requirements.txt. In step 8, we installed all those requirements via the pip3 install command.

That’s it. Now, you can run the Odoo instance.

Starting the instance

Now comes the moment you’ve been waiting for. To start our first instance, in step 9, we created a new empty database, used the odoo-bin script, and then started the Odoo instance with the following command:

python3 odoo-bin -d odoo-test -i base --addons-path=addons --db-filter=odoo-test$

You can also omit python3 by using ./ before odoo-bin as it is an executable Python script:

./odoo-bin -d odoo-test -i base --addons-path=addons --db-filter=odoo-test$

With odoo-bin, a script with the following command-line arguments is used:

  • -d database_name: Use this database by default.
  • --db-filter=database_name$: Only try to connect to databases that match the supplied regular expression. One Odoo installation can serve multiple instances that live in separate databases, and this argument limits the available databases. The trailing $ is important as the regular expression is used in match mode. This enables you to avoid selecting names starting with the specified string.
  • --addons-path=directory1,directory2,...: This is a comma-separated list of directories in which Odoo will look for add-ons. This list is scanned at instance creation time to populate the list of available add-on modules in the instance. If you want to use Odoo’s Enterprise Edition, then add its directory with this option.
  • -i base: This is used to install a base module. This is required when you have created a database via the command line.

If you are using a database user with a database login that is different from your Linux login, you need to pass the following additional arguments:

  • --db_host=localhost: Use a TCP connection to the database server
  • --db_user=database_username: Use the specified database login
  • --db_password=database_password: This is the password for authenticating against the PostgreSQL server

To get an overview of all available options, use the --help argument. We will see more of the odoo-bin script later in this chapter.

When Odoo is started on an empty database, it will create the database structure that’s needed to support its operations. It will also scan the add-on path to find the available add-on modules and insert some into the initial records in the database. This includes the admin user with the default admin password, which you will use for authentication.

Pointing your web browser to http://localhost:8069/ leads you to the login page of your newly created instance, as shown in the following screenshot:

Figure 1.2 – Login screen of the Odoo instance

Figure 1.2 – Login screen of the Odoo instance

This is because Odoo includes an HTTP server. By default, it listens on all local network interfaces on TCP port 8069.

Managing Odoo server databases

When working with Odoo, all the data in your instance is stored in a PostgreSQL database. All the standard database management tools you are used to are available, but Odoo also proposes a web interface for some common operations.

Getting ready

We are assuming that your work environment is set up and that you have an instance running.

How to do it...

The Odoo database management interface provides tools to create, duplicate, remove, back up, and restore a database. There is also a way to change the master password, which is used to protect access to the database management interface.

Accessing the database management interface

To access the database, perform the following steps:

  1. Go to the login screen of your instance (if you are authenticated, log out).
  2. Click on Manage Databases. This will navigate you to http://localhost:8069/web/database/manager (you can also point your browser directly to that URL):
Figure 1.3 – Database manager

Figure 1.3 – Database manager

Setting or changing the master password

If you’ve set up your instance with default values and haven’t modified it yet, as we will explain in the following section, the database management screen will display a warning, telling you that the master password instance hasn’t been set and will advise you to set one with a direct link:

Figure 1.4 – Master password warning

Figure 1.4 – Master password warning

To set the master password, perform the following steps:

  1. Click on the Set Master Password button. You will get a dialog box asking you to fill in the New Master Password field:
Figure 1.5 – Setting a new master password

Figure 1.5 – Setting a new master password

  1. Type in a complex new password and click Continue.

If the master password is already set, click on the Set Master Password button at the bottom of the screen to change it. In the dialog box that opens, type the previous master password and the new one, and then click Continue:

Figure 1.6 – Changing the master password

Figure 1.6 – Changing the master password

Note

The master password is the server configuration file under the admin_passwd key. If the server is started without a configuration file being specified, a new one will be generated in ~/.odoorc. Refer to the next recipe for more information about the configuration file.

Creating a new database

This dialog box can be used to create a new database instance that will be handled by the current Odoo server. Follow these steps:

  1. On the database management screen, click on the Create Database button, which can be found at the bottom of the screen. This will bring up the following dialog:
Figure 1.7 – The Create Database dialog

Figure 1.7 – The Create Database dialog

  1. Fill in the form, as follows:
    • Master Password: This is the master password for this instance.
    • Database Name: Input the name of the database you wish to create.
    • Email: Add your email address here; this will be your username later.
    • Password: Type in the password you want to set for the admin user of the new instance.
    • Phone Number: Set your phone number (optional).
    • Language: Select the language that you wish to be installed by default in the new database in the drop-down list. Odoo will automatically load the translations for the selected language.
    • Country: Select the country of the main company in the drop-down list. Selecting this will automatically configure a few things, including the company’s currency.
    • Demo data: Check this box to obtain demonstration data. This is useful for running interactive tests or setting up a demonstration for a customer, but it should not be checked for a database that is designed to contain production data.

Note

If you wish to use the database to run automated tests for the modules (refer to Chapter 7, Debugging Modules), you need to have the demonstration data since the vast majority of the automated tests in Odoo depend on these records to run successfully.

  1. Click Continue and wait until the new database is initialized. After, you will be redirected to the instance and connected as the administrator.

Troubleshooting

If you are redirected to a login screen, this is probably because the --db-filter option was passed to Odoo and the new database name didn’t match the filter option. Note that the odoo-bin start command does this silently, making only the current database available. To work around this, simply restart Odoo without the start command, as shown in the Installing Odoo from the source recipe. If you have a configuration file (refer to the Storing the instance configuration in a file recipe later in this chapter), check that the db_filter option is unset or set to a value matching the new database name.

Duplicating a database

Often, you will have an existing database, and you will want to experiment with it to try a procedure or run a test, but without modifying the existing data. The solution here is simple: duplicate the database and run the test on the copy. Repeat this as many times as required:

  1. On the database management screen, click on the Duplicate Database link next to the name of the database you wish to clone:
Figure 1.8 – The Duplicate Database dialog

Figure 1.8 – The Duplicate Database dialog

  1. Fill in the form, as follows:
    • Master Password: This is the master password of the Odoo server
    • New Name: The name you want to give to the copy
  2. Click Continue.
  3. You can then click on the name of the newly created database on the database management screen to access the login screen for that database.

Removing a database

When you have finished your tests, you will want to clean up the duplicated databases. To do this, perform the following steps:

  1. On the database management screen, you will find the Delete button next to the name of the database. Clicking on it will bring up the following dialog:
Figure 1.9 – The Delete Database dialog

Figure 1.9 – The Delete Database dialog

  1. Fill in the form, as well as the Master Password field, which is the master password of the Odoo server.
  2. Click Delete.

Caution! Potential data loss!

If you selected the wrong database and have no backup, there is no way to recover the lost data.

Backing up a database

To create a backup, perform the following steps:

  1. On the database management screen, you will find the Backup button next to the database’s name. Clicking on it will bring up the following dialog:
Figure 1.10 – The Backup Database dialog

Figure 1.10 – The Backup Database dialog

  1. Fill in the form, as follows:
    • Master Password: This is the master password of the Odoo server.
    • Backup Format: Always use zip for a production database since this is the only real full backup format. Only use the pg_dump format for a development database when you don’t care about the file store.
  2. Click Backup. The backup file will be downloaded to your browser.

Restoring a database backup

If you need to restore a backup, this is what you need to do:

  1. On the database management screen, you will find a Restore Database button at the bottom of the screen. Clicking on it will bring up the following dialog:
Figure 1.11 – The Restore Database dialog

Figure 1.11 – The Restore Database dialog

  1. Fill in the form, as follows:
    • Master Password: This is the master password of the Odoo server.
    • File: This is a previously downloaded Odoo backup.
    • Database Name: Provide the name of the database in which the backup will be restored. The database must not exist on the server.
    • This database might have been moved or copied: Choose This database was moved if the original database was on another server or if it has been deleted from the current server. Otherwise, choose This database is a copy, which is the safe default option.
  2. Click Continue.

Note

It isn’t possible to restore a database on top of itself. If you try to do this, you will get an error message (Database restore error: Database already exists). You need to remove the database first.

How it works...

These features, apart from the Change master password screen, run PostgreSQL administration commands on the server and report back through the web interface.

The master password is a very important piece of information that only lives in the Odoo server configuration file and is never stored in the database. There used to be a default value of admin, but using this value is a security liability. In Odoo v9 and later, this is identified as an unset master password, and you are urged to change it when accessing the database administration interface. Even if it is stored in the configuration file under the admin_passwd entry, this is not the same as the password of the admin user; these are two independent passwords. The master password is set for an Odoo server process, which itself can handle multiple database instances, each of which has an independent admin user with their own password.

Security considerations

Remember that we are considering a development environment in this chapter. The Odoo database management interface is something that needs to be secured when you are working on a production server as it gives access to a lot of sensitive information, especially if the server hosts Odoo instances for several different clients.

To create a new database, Odoo uses the PostgreSQL createdb utility and calls the internal Odoo function to initialize the new database in the same way as when you start Odoo on an empty database.

To duplicate a database, Odoo uses the --template option of createdb, passing the original database as an argument. This duplicates the structure of the template database in the new database using internal and optimized PostgreSQL routines, which is much faster than creating a backup and restoring it (especially when using the web interface, which requires you to download the backup file and upload it again).

Backup and restore operations use the pg_dump and pg_restore utilities, respectively. When using the zip format, the backup will also include a copy of the file store that contains a copy of the documents when you configure Odoo so that it doesn’t keep these in the database; this is the default option in 14.0. Unless you change it, these files reside in ~/.local/share/Odoo/filestore.

If the backup becomes too large, downloading it may fail. This will be either because the Odoo server itself is unable to handle the large file in memory or because the server is running behind a reverse proxy because there is a limit to the size of HTTP responses that were set in the proxy. Conversely, for the same reasons, you will likely experience issues with the database restore operation. When you start running into these issues, it’s time to invest in a more robust external backup solution.

There’s more...

Experienced Odoo developers generally don’t use the database management interface and perform operations from the command line. To initialize a new database with demo data, for instance, the following single-line command can be used:

$ createdb testdb && odoo-bin -d testdb

The bonus of using this command line is that you can request add-ons to be installed while you are using it – for instance, -i sale,purchase,stock.

To duplicate a database, stop the server and run the following commands:

$ createdb -T dbname newdbname
$ cd ~/.local/share/Odoo/filestore # adapt if you have changed the data_dir
$ cp -r dbname newdbname
$ cd -

Note that, in the context of development, the file store is often omitted.

Note

The use of createdb -T only works if there are no active sessions on the database, which means that you have to shut down your Odoo server before duplicating the database from the command line.

To remove an instance, run the following command:

$ dropdb dbname
$ rm -rf ~/.local/share/Odoo/filestore/dbname

To create a backup (assuming that the PostgreSQL server is running locally), use the following command:

$ pg_dump -Fc -f dbname.dump dbname
$ tar cjf dbname.tgz dbname.dump ~/.local/share/Odoo/filestore/dbname

To restore the backup, run the following command:

$ tar xf dbname.tgz
$ pg_restore -C -d dbname dbname.dump

Caution!

If your Odoo instance uses a different user to connect to the database, you need to pass -U username so that the correct user is the owner of the restored database.

Storing the instance configuration in a file

The odoo-bin script has dozens of options, and it is tedious to remember them all, as well as how to remember to set them properly when starting the server. Fortunately, it is possible to store them all in a configuration file and only specify the ones you want to alter for development, for example.

How to do it...

For this recipe, perform the following steps:

  1. To generate a configuration file for your Odoo instance, run the following command:
    $ ./odoo-bin --save --config myodoo.cfg --stop-after-init
  2. You can add additional options, and their values will be saved in the generated file. All the unset options will be saved with their default value set. To get a list of possible options, use the following command:
    $ ./odoo-bin --help | less

    This will provide you with some help about what the various options perform.

  3. To convert from the command-line form into the configuration form, use the long option name, remove the leading dashes, and convert the dashes in the middle into underscores. So, in this case, --without-demo will become without_demo. This works for most options, but there are a few exceptions, all of which are listed in the following section.
  4. Edit the myodoo.cfg file (use the table in the following section for some parameters you may want to change). Then, to start the server with the saved options, run the following command:
    $ ./odoo-bin -c myodoo.cfg

Note

The --config option is commonly abbreviated as -c.

How it works...

At startup, Odoo loads its configuration in three passes. First, a set of default values for all options is initialized from the source code. After, the configuration is parsed, and then any value that’s defined in the file overrides the defaults. Finally, the command-line options are analyzed, and their values override the configuration that was obtained from the previous pass.

As we mentioned earlier, the names of the configuration variables can be found by looking at the names of the command-line options by removing the leading dashes and converting the middle dashes into underscores. There are a few exceptions to this, notably the following:

Table 1.1 – Difference in Odoo parameters regarding the command line and the configuration file

Table 1.1 – Difference in Odoo parameters regarding the command line and the configuration file

Here’s a list of options that are commonly set through the configuration file:

Table 1.2 – Odoo parameters and their usage

Table 1.2 – Odoo parameters and their usage

Here’s a list of configuration options related to the database:

Table 1.3 – Odoo parameters and their usage

Table 1.3 – Odoo parameters and their usage

The configuration file is parsed by Odoo using the Python ConfigParser module. However, the implementation in Odoo 11.0 has changed, and it is no longer possible to use variable interpolation. So, if you are used to defining values for variables from the values of other variables using the %(section.variable)s notation, you will need to change your habits and revert to explicit values.

Some options are not used in config files, but they are widely used during development:

Table 1.4 – Odoo parameters and their usage

Table 1.4 – Odoo parameters and their usage

Activating Odoo developer tools

When using Odoo as a developer, you need to know how to activate developer mode in the web interface so that you can access the technical settings menu and developer information. Enabling debug mode will expose several advanced configuration options and fields. These options and fields are hidden in Odoo for better usability because they are not used daily.

How to do it...

To activate developer mode in the web interface, perform the following steps:

  1. Connect to your instance and authenticate as admin.
  2. Go to the Settings menu.
  3. Scroll to the bottom and locate the Developer Tools section:
Figure 1.12 – Links to activate different developer modes

Figure 1.12 – Links to activate different developer modes

  1. Click Activate the developer mode.
  2. Wait for the UI to reload.

Alternative way

It is also possible to activate developer mode by editing the URL. Before the # sign, insert ?debug=1. For example, if your current URL is http://localhost:8069/web#menu_id=102&action=94 and you want to enable developer mode, then you need to change that URL to http://localhost:8069/web?debug=1#menu_id=102&action=94. Furthermore, if you want to use debug mode with assets, then change the URL to http://localhost:8069/web?debug=assets#menu_id=102&action=94.

To exit developer mode, you can perform any one of the following operations:

  • Edit the URL and write ?debug=0 in the query string
  • Use Deactivate the developer mode from the same place in the Settings menu
  • Click on the bug icon in the top menu and click on the Leave Developer Tools option

Lots of developers are using browser extensions to toggle debug mode. By doing this, you can toggle debug mode quickly without accessing the Settings menu. These extensions are available for Firefox and Chrome. The following screenshot shows one such plugin you can use and find in the Chrome store:

Figure 1.13 – Browser extension for debug mode

Figure 1.13 – Browser extension for debug mode

Note

The behavior of the debug mode has changed since Odoo v13. Since v13, the status of debug mode is stored in the session, implying that even if you have removed ?debug from the URL, debug mode will still be active.

How it works...

In developer mode, two things happen:

  • You get tooltips when hovering over a field in a form view or over a column in a list view. These provide technical information about the field (internal name, type, and so on).
  • A drop-down menu with a bug icon is displayed next to the user’s menu in the top-right corner, giving you access to technical information about the model being displayed, the various related view definitions, the workflow, custom filter management, and so on.

There is a variant of developer mode called Developer mode (with assets). This mode behaves like the normal developer mode, but the JavaScript and CSS code that’s sent to the browser is not minified, which means that the web development tools of your browser can easily be used to debug the JavaScript code (more on this in Chapter 15, Web Client Development).

Caution!

Test your add-ons both with and without developer mode since the unminified versions of the JavaScript libraries can hide bugs that only bite you in the minified version.

Updating the add-on modules list

When a new add-on module is added, you need to run the Update Module List wizard to get your new application in the app list. In this recipe, you will learn how to update the app list.

Getting ready

Start your instance and connect to it using your Administrator account. After doing this, activate developer mode (if you don’t know how to activate developer mode, refer to the Activating Odoo developer tools recipe).

How to do it…

To update the list of available add-on modules in your instance, you need to perform the following steps:

  1. Open the Apps menu.
  2. Click Update Apps List:
Figure 1.14 – Update Apps List

Figure 1.14 – Update Apps List

  1. In the dialog that appears, click Update:
Figure 1.15 – Dialog to update the apps list

Figure 1.15 – Dialog to update the apps list

  1. At the end of the update, you can click on the Apps entry to see the updated list of available add-on modules. You will need to remove the default filter on Apps in the search box to see all of them.

How it works…

When the Update button is clicked, Odoo will read the add-on path configuration variable. For each directory in the list, it will look for immediate subdirectories containing an add-on manifest file, which is a file named __manifest__.py that’s stored in the add-on module directory. Odoo reads the manifest, expecting to find a Python dictionary. Unless the manifest contains a key installable instance set to False, the add-on module metadata is recorded in the database. If the module is already present, the information is updated. If not, a new record is created. If a previously available add-on module is not found, the record is not deleted from the list.

Note

An updated apps list is only required if you add the new add-on path after initializing the database. If you add the new add-on path to the configuration file before initializing the database, then there will be no need to update the module list manually.

To summarize what we have learned so far, after installing, you can start the Odoo server by using the following command line (if you are using a virtual environment, then you need to activate it first):

python3 odoo-bin -d odoo-test -i base --addons-path=addons --db-filter=odoo-test

Once you’ve run the module, you can access Odoo from http://localhost:8069.

You can also use a configuration file to run Odoo, as follows:

./odoo-bin -c myodoo.cfg

Once you start the Odoo server, you can install/update modules from the App menu.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Create web client components using the latest features in the Odoo Web Library
  • Discover new widgets for display screens, fields, and attributes in Odoo 17
  • Build apps and websites with confidence with the help of this trusted community edition
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

The latest version of the powerful Odoo framework uncovers a wide variety of features for rapid application development. Written by seasoned Odoo experts, this updated Odoo Development Cookbook will help you explore Odoo 17’s new features and use them to develop applications from scratch. You'll learn about website development concepts and get to grips with the Odoo Web Library (OWL), as well as create a new Odoo module from the ground up before progressing to advanced framework concepts. The book also shows you how to modify existing applications, including Point of Sale (POS) applications. Going beyond backend development, you'll discover advanced JavaScript recipes for creating new views and widgets. You'll get a clear understanding of website development and be on your way to becoming a proficient Odoo developer by studying performance optimization, debugging, and automated testing. By the end of this book, you'll have the knowledge you need to build impressive applications and be well-versed in Odoo development best practices.

Who is this book for?

This book is for developers who are new to the Odoo framework and want to develop effective business applications. Experienced Odoo developers looking to revisit specific topics or discover new features in Odoo 17 may also benefit from this book. Basic knowledge of Python programming and JavaScript programming is necessary to get the most out of this book.

What you will learn

  • Build intuitive websites with Odoo CMS using dynamic building blocks
  • Get to grips with advanced concepts such as caching, prefetching, and debugging
  • Modify backend JavaScript components and POS applications with the updated OWL framework
  • Connect and access any object in Odoo via Remote Procedure Calls (RPCs)
  • 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 Cyprus

Premium delivery 7 - 10 business days

€32.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 31, 2024
Length: 774 pages
Edition : 5th
Language : English
ISBN-13 : 9781805124276
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
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Cyprus

Premium delivery 7 - 10 business days

€32.95
(Includes tracking information)

Product Details

Publication date : May 31, 2024
Length: 774 pages
Edition : 5th
Language : English
ISBN-13 : 9781805124276
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.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
€189.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
€264.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 112.97
Odoo Development Cookbook
€37.99
Odoo 15 Development Essentials
€35.99
Mastering PostgreSQL 15
€38.99
Total 112.97 Stars icon
Banner background image

Table of Contents

27 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
Chapter 25: Web Studio Chevron down icon Chevron up icon
Index 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.2
(10 Ratings)
5 star 50%
4 star 20%
3 star 30%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Greg Mader Aug 07, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The challenge with writing about Odoo is to manage all of the changes between versions. Sometimes they are big changes, sometimes they are small. This book tries to address the situation, and I think it does so pretty effectively. I would feel comfortable recommending this book to new or experienced developers.
Amazon Verified review Amazon
Raaj Jun 20, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
For odoo developers, it's beyond theoretical concepts. Offering real world solutions and practical tips to both beginners and seasoned professionals...
Amazon Verified review Amazon
Dharmang Soni Jul 22, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As an Odoo expert and architect, I can confidently say that the "Odoo 17 Development Cookbook" is an excellent resource for developers at all levels, particularly those looking for a single reference for their Odoo development learning.Having read this book, I appreciate its practical, hands-on approach to solving real-world development challenges within the Odoo framework. It covers both backend and frontend development comprehensively, including the newly designed web architecture Odoo Web Language (OWL) in depth.This book is an indispensable guide for anyone serious about mastering Odoo 17 development. Great work!Thank you.
Amazon Verified review Amazon
Farshid Ghyasi Aug 07, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is the first Odoo development book I am reading and I find it to be a fantastic resource for newcomers to Odoo development. The book written with clear and simple language that makes it easy to understand. It offers in-depth coverage of various Odoo development topics, guiding readers through the process of learning Odoo development and building effective business applications with Odoo 17. Whether you're new to Odoo or looking to expand your skills, this book provides valuable insights and practical examples that are both educational and accessible.
Amazon Verified review Amazon
Serhii Miroshnychenko Jun 18, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I keep a close eye on everything new and useful when it comes to Odoo development, as this is my main area of ​​interest.Recently, I had the opportunity to read the new book just launched "Odoo Development Cookbook" by Husen Daudi and Jay Vora. So I hasten to share with you my impressions of it.This is the most complete and informative book on the topic of development under Odoo that I have come across so far. Here is a far from complete list of its advantages:1. Guides you through all the main topics needed by an Odoo developer;2. Contains detailed and clear code examples, which can also be viewed on GitHub;3. Considers both the creation and customization of modules, as well as their debugging and testing;4. Covers the internalization section in detail;5. Familiar with both Python development and JavaScript (including Mobile app JavaScript);6. Provides an overview of the Odoo Web Library;7. Contains techniques for managing, deploying, and testing with Odoo.sh;8. Describes methods of external integrations;9. Pays considerable attention to the issue of Performance Optimization;10. Managing the sending of Emails, working with IoT, and using Web Studio - this is far from a complete list of topics that are qualitatively covered in this excellent book.Regarding possible improvements:1. Although the design of the book fully meets the standards for this industry, I, as a developer, would still like it better if the code elements in the examples were highlighted with colors (similar to highlighting in Markdown files);2. There were not enough explanations regarding the use of the odoo.fields.Command class when working with relational fields;My general conclusion: this book is definitely a must-have for every Odoo developer continuing to grow in their chosen profession.
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