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:
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
ii. EAN13 Barcode on an Invoice
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.