How to Print Barcodes in Odoo QWeb Reports
All Supported Formats Explained

Using Barcodes in Odoo Reports

Need to print barcodes on your Odoo delivery slips, product labels, or invoices? Odoo supports a wide range of barcode formats. Whether you want to print EAN13 product codes, QR codes for tracking, or DataMatrix labels, you can do it directly from your QWeb reports.

In this guide, we’ll cover:

  • Which barcode formats are supported in Odoo (via ReportLab)
  • How they’re used in Odoo reports
  • Sample QWeb snippets to help you get started

1. Barcode Formats Supported by Odoo (via ReportLab)

Odoo uses the ReportLab library to generate barcodes in PDF reports. This means any barcode type supported by ReportLab can be embedded in your QWeb templates.

The following table lists all supported barcode types:

Barcode Type Example Barcode Allowed Characters / Description
Codabar Codabar Barcode Example Digits 0-9 and - : $ / . +, plus start/stop (A-D)
Code11 Code11 Barcode Example Digits 0-9, dash (-)
Code128 Code128 Barcode Example Full ASCII set; compact, high-density
Code128Auto Code128Auto Barcode Example Automatically optimizes encoding within Code128
EAN13 EAN13 Barcode Example 13 digits (GTIN-13)
EAN8 EAN8 Barcode Example 8 digits
EAN5 EAN5 Barcode Example 5 digits (supplement to EAN13/8)
Standard39 (Code39) Standard39 Code39 Barcode Example A-Z, 0-9, - . space $ / + %
Extended39 Extended39 Barcode Example Full ASCII (via escape codes)
Standard93 (Code93) Standard93 Code93 Barcode Example Compact, alphanumeric
Extended93 Extended93 Barcode Example Full ASCII version of Code93
MSI MSI Barcode Example Numeric only
POSTNET POSTNET Barcode Example
QR Code QR Code Example Alphanumeric / text / URLs
Standard39 Code39 Barcode Usage Example Code39 is widely used in non-retail, especially US defence and health. Allowed characters are 0-9, A-Z (caps only), space, and -.$/+%*
Standard93 Code93 Compact Example This is a compressed form of Code 39
UPCA UPCA Barcode Example
USPS_4State USPS 4-State Barcode Example

2. How Barcode Types Are Used in Odoo Reports

Odoo integrates ReportLab’s barcode generation engine into its reporting system by default. This means any barcode format supported by ReportLab can be directly embedded in QWeb PDF reports, such as:

  • Products → Print the product’s internal reference or barcode field for retail use.
  • Lots/Serial Numbers → Generate barcodes for traceability across the supply chain.

In practice, the barcode type (e.g., Code128, EAN13, QR) defines the encoding standard, while the value (e.g., o.default_code, o.barcode, or lot.name) is the actual business data you want to represent.

3. Sample QWeb Code for Printing Barcodes

Here are some practical code snippets you can drop into your Odoo QWeb reports:

i. ECC200 DataMatrix on a Delivery Slip
<t t-foreach="docs" t-as="o">
  <div class="page">
    <h3>Delivery Slip</h3>
    <p>Picking Reference: 
      <t t-esc="o.name"/></p>
    <img
      t-att-src="'/report/barcode/?barcode_type=%s&amp;value=%s&amp;
      width=%s&amp;height=%s' % ('ECC200DataMatrix', o.name, 30, 30)"/>
  </div>
</t>
ii. EAN13 Barcode on an Invoice
<div>
  <p>Invoice Number: 
    <t t-esc="o.name"/></p>
  <img
    t-att-src="'/report/barcode/?type=EAN13&amp;
    value=%s&amp;width=400&amp;height=80' % o.name"
    style="width:180px; height:40px;"/>
</div>

Tips: You can adjust the width and height to fit your report layout.

Ensure that the value matches the required format for that barcode type (e.g., 13 digits for EAN13).

Wrapping Up

Odoo’s integration with ReportLab makes barcode generation straightforward and flexible. You can print barcodes on almost any report, improving process automation across sales, inventory, and logistics.

Found this article useful?

Explore more development guides and solutions from our team.

Check out more posts
تسجيل الدخول حتى تترك تعليقاً
Splitting Salaries by Cost Center & Location in Odoo