Generating Barcodes in Odoo: A Practical Guide to Shipping Labels

If you’ve ever needed a barcode on an invoice, a product label, or a shipping label in Odoo, you don’t need a third-party library, a paid module, or a JavaScript barcode renderer. Odoo ships with a built-in barcode image generator that you can drop straight into any QWeb report. This post walks through how it works, how to use it, and a few gotchas that can trip you up.

Where the Barcode Actually Comes From

Odoo’s report module exposes a controller at:

/report/barcode/

Under the hood, this endpoint uses the ReportLab library to render a barcode image on the fly and return it as a PNG. Because it’s just an HTTP endpoint that returns an image, you can use it anywhere you’d use a normal <img> tag such as QWeb reports, website pages, even a plain browser URL for testing.

Basic Usage

The controller takes the barcode type and value as positional path segments, with everything else as optional query parameters:

/report/barcode/<barcode_type>/<value>?width=...&height=...
PartRequiredDescription
barcode_type (path segment)YesBarcode symbology e.g. Code128, EAN13, QR, Code39
value (path segment)YesThe actual data to encode
width (query param)NoImage width in pixels (default 600)
height (query param)NoImage height in pixels (default 100)

Try it directly in your browser first, before touching any XML:

http://localhost:8069/report/barcode/Code128/1234567890?width=450&height=60

Using It Inside a QWeb Report

Inside a report template, build the path with t-att-src since you’re constructing a Python string, not filling in a fixed template:

<img
    t-if="o.biteship_reference_id"
    class="barcode"
    t-att-src="'/report/barcode/Code128/%s?width=350&height=45' % o.biteship_reference_id"
    alt="Barcode"/>

A few details matter here:

  • Guard with t-if. If the field is empty, don’t even attempt to render the image or you’ll get a broken image icon instead of a clean blank space.
  • width/height as query params, not path segments. If you want to control the rendered size, append them as a query string on the constructed URL: '/report/barcode/Code128/%s?width=450&height=60' % o.carrier_tracking_ref. Plain HTML width/height attributes on the <img> tag also work fine for display sizing and are simpler when you don’t need the server to render at a specific resolution.
  • URL-encode the value if needed. If your barcode data can contain special characters (&, #, /, spaces), pass it through werkzeug.urls.url_quote() first since the value is now a path segment rather than a query parameter, an unescaped / in particular will break the routing:
<img t-if="o.carrier_tracking_ref"
     class="barcode"
     t-att-src="'/report/barcode/Code128/%s' % werkzeug.urls.url_quote(o.carrier_tracking_ref)"
     alt="Barcode"/>

Choosing Barcode Type

Odoo supports most common symbologies through ReportLab, including:

  • Code128: general-purpose, alphanumeric, most common choice for tracking numbers and reference IDs
  • EAN13 / EAN8: retail product barcodes
  • Code39: widely supported by older scanners
  • QR: for anything that needs more data density (URLs, structured data)

For shipping labels and tracking numbers specifically, Code128 is almost always the right pick as it handles letters, numbers, and dashes cleanly, which is exactly the format most courier waybill numbers use.

Summary

The barcode controller is one of those small, easy-to-miss pieces of Odoo that solves a problem people often reach for external tools to fix. Once you’ve confirmed the endpoint works on its own, wiring it into a QWeb report is just a matter of a correctly-escaped, correctly-encoded <img> tag with no extra Python dependencies in your own module required.

Book a Free Consultation

Haven’t found the right solution yet?
Tell us about your needs, and let’s discuss the best solution together.

Project description.

Built a private marketplace research and purchase planning platform for Shopee. The system tracks product performance over time, estimates sales velocity and gross revenue, analyzes demand across product variants, and turns the research into actionable purchasing plans. It also calculates supplier costs, shipping, platform fees, margins, planned investment, and estimated earnings to support data-driven sourcing decisions.

Skills and deliverables

Full-Stack Development, Web Application Development, Data Analysis, Business Process Automation, Business Intelligence

Shopee Marketplace Research & Purchase Planning Dashboard

We built this application to solve a common problem in marketplace sourcing: finding products is easy, but deciding what is actually worth buying, which variant to prioritize, and how much inventory to purchase requires much more analysis. Instead of relying on a single product snapshot, the system organizes products into research collections and tracks their marketplace performance over time.

Product research & tracking

Products can be added individually or collected from marketplace stores and organized into dedicated research collections. The system keeps historical observations so users can compare changes between captures instead of relying only on the latest marketplace data. This makes it possible to estimate metrics such as: – Sales velocity – Estimated daily gross revenue – Price changes – Product movement over time – Variant-level demand

Variant demand analysis

One of the most important parts of the system is identifying which variants are actually driving sales. Instead of treating a product as a single item, the application analyzes sales movement at variant level and shows each variant’s contribution to recent demand. This helps identify which sizes, models, or variations should be prioritized when purchasing inventory.

Purchase planning

Research data can then be converted directly into a purchasing plan. For every product and variant, the user can enter supplier pricing, shipping costs, purchase quantities, exchange rates, and other operational costs. The system automatically calculates: – Planned inventory investment – Shipping cost – Marketplace/platform fees – Net margin per unit – Net margin percentage – Estimated earnings – Total batch investment This allows purchasing decisions to be evaluated before committing capital.

Why We built it

The goal was to replace a workflow that would normally require multiple spreadsheets, manual marketplace checks, and repeated calculations. The resulting workflow became: Discover products → Track performance → Analyze demand → Select variants → Plan purchasing → Estimate margins Everything is kept in one application, making the research and sourcing process easier to review, repeat, and scale.

Result

The platform turns raw marketplace observations into actionable purchasing information. Instead of choosing products based only on intuition or current sales numbers, users can evaluate sales movement, variant demand, sourcing cost, expected margin, and required investment before making a purchasing decision. Built as an end-to-end internal tool, from data collection and analysis to the final purchasing workflow.

Project description.

Built a browser-based tool that converts Shopee/SPX order exports into clean, print-ready shipping labels. It supports multiple Excel/CSV files, combines orders into one preview, and automatically generates QR codes, barcodes, tracking numbers, and product information for 68 mm thermal printers. All order data is processed locally in the browser for better privacy, eliminating repetitive manual label formatting.

Skills and deliverables

Laravel, Business Automation, CSV, Microsoft Excel

Shopee SPX Order Label Maker for Thermal Printing

This tool was built to simplify the shipping label preparation process for Shopee SPX orders. The existing workflow required order data to be exported from Shopee and manually formatted before it could be printed on a thermal printer. This became repetitive and time-consuming, especially when processing multiple orders at once.

We built a browser-based label generator that reads Shopee Excel/CSV exports and automatically converts the order data into clean, print-ready SPX labels. The tool automatically handles: – Tracking numbers – QR codes – Barcodes – Product names and variants – Order quantities – Multiple order files at once – 68 mm thermal printer formatting Users can review all generated labels before printing, without having to manually copy or reorganize the order information.

The order files are processed directly inside the browser instead of being uploaded to a server. This keeps customer and shipment data private while also making the tool fast and simple to use.