Creating QR Codes in Odoo 14: A Guide

A quick response code, also known as a QR code, resembles a barcode and is commonly used for information tracking. It consists of a white background with a square grid of black squares that can be read by imaging equipment and store large amounts of data, making it easily accessible.

InOdoo, QR codes are useful for tracking information about products, stock movements, invoices, sales, and purchases. This guide will explain how to create a QR code in Odoo 14 in detail, including an illustration of a QR code for a specific invoice.

The QR code will show information such as the customer, invoice date, and payment reference. A python package called “qrcode” is used to generate QR codes, which makes creating QR code images easy. To use it, the package must first be installed using the “pip3 install qrcode” command in the terminal.

The code example for creating a QR code with invoice information such as customer, invoice date, and payment reference is shown below. The base64 library is imported for the image, and the QR code fields are calculated into the inherited python file, respectively.

Here is the related XML file:

  • Version:The size of the QR code is controlled by a parameter, which is an integer ranging from 1 to 40 (version 1, for example, is a 21 by 21 matrix).
  • Error correction:This setting regulates the QR code’s error correction.
  • Box size:This setting determines how many pixels each box must collect.
  • Border:It determines how many boxes there should be and how thick the border should be (default=4).

In this example, producing the QR code of an invoice, company name, reference of the payment, client, and salesperson details are added using the.add dataargument. Additionally, themake imagefunction of the QR will create an image utilizing all of the arguments.

The associated image can be stored in PNG or SVG format; in this case, PNG is used. It is then encoded with the appropriate value and given to a specific value in the field on the invoice.

When a QR code is scanned, the results are displayed as


By using this technique, we can create a QR code that contains information from several records in Odoo 14.

Hire Dedicated Developers

Reach new heights with WanBuffer’s offshore engineering team. Our team of over 50 highly skilled and dedicated full-stack software engineers have the expertise and experience to tackle your key technology challenges, improve efficiency and reduce expenses. Let us help you drive your business forward today.

Schedule Meeting