Print Odoo ZPL labels without the IoT Box
Send ZPL from Odoo to a Zebra the OS can already see. No PrintBase Odoo app and no IoT Box — a server action calls the API.
For Odoo users who have a Zebra on a warehouse PC and do not want an IoT Box
This page in another language: 中文
Overview
Odoo's IoT Box is one way to reach a printer. It is not required if a normal PC next to the Zebra already has the printer installed and can run an outbound agent. PrintBase is not an Odoo App Store module. You add a small server action or a custom module that POSTs ZPL.
Generate the ZPL in Odoo (a 4 by 6 label is 812 by 1218 dots at 203 dpi, and a different size at 300 dpi). Send it as content_type raw with the warehouse printer_code. The agent writes those bytes to the OS queue. It does not speak Odoo's IoT protocol.
Use an Idempotency-Key of the picking name plus the label sequence. Reprinting a damaged label needs a new key. The API key belongs in an Odoo system parameter, not in a QWeb template the browser can view.
Integration steps
- 01
Skip the IoT Box on purpose
Install the PrintBase agent on the PC that already prints to the Zebra. Confirm the queue with a local test page before you involve Odoo.
- 02
Render ZPL in the module
Build ^XA…^XZ for the product, barcode, and qty. Set ^PW and ^LL in dots for that printhead's dpi.
- 03
POST raw from a server action
Python on the Odoo server calls the API. Do not call it from the website visitor's browser.
- 04
Store printer_code per warehouse
A stock.warehouse or a work center can hold the code. The API has no Odoo location object.
- 05
Surface the job id on the picking
Write job id and status onto the picking so the warehouse can see AGENT_OFFLINE without reading logs.
Python
# Odoo server action: ZPL label, no IoT Box
import json, os, urllib.request
body = json.dumps({
"printer_code": int(os.environ["PRINTER_CODE"]),
"content_type": "raw",
"content": base64.b64encode(zpl.encode()).decode(),,
"copies": 1,
}).encode()
req = urllib.request.Request(
"https://api.printbase.cloud/v1/print-jobs",
data=body,
method="POST",
headers={
"Authorization": f"Bearer {os.environ['PRINTBASE_API_KEY']}",
"Content-Type": "application/json",
"Idempotency-Key": picking.name,
},
)
with urllib.request.urlopen(req) as res:
job = json.load(res) # {"id": "job_abc", "status": "queued"}
Details for this setup
Raw bytes for Odoo ZPL
Use content_type raw. The agent refuses a PDF, PNG, or JPEG disguised as raw and returns INVALID_CONTENT. Windows sends the bytes to the spooler from memory. macOS and Linux call lp -o raw. For a single ^XA…^XZ label with copies greater than 1 and no existing ^PQ, ^SN, or ^SF, the agent inserts ^PQ so the printer repeats the label.
IoT Box is a different product
This page does not configure Odoo IoT. If you already use an IoT Box, you do not have to remove it for printers this agent is not driving.
Questions
Is there an official Odoo module?
No PrintBase module is shipped in this product. A server action or a tiny custom module is the integration.
Can I send Odoo's PDF report instead?
Yes. Use content_type pdf for the PDF report. Use raw only for ZPL or other printer commands. See the delivery-slip page for PDF.
203 dpi labels print small on a 300 dpi Zebra.
Dots are not inches. Rebuild ^PW and ^LL for the printhead, or the label shrinks.
Does the agent need the Zebra on port 9100?
It needs the OS to list the printer. The agent does not open a public port. Raw jobs go to that queue (Windows spooler, or lp -o raw).
Free plan: 100 jobs a month on one computer, no card.