Skip to main content

Odoo Local Print Client

A secure, zero-footprint local printing client for Odoo. This client connects to your Odoo instance via WebSockets, listens for print jobs on the Odoo Bus, and pipes documents directly to your local Linux print spooler (CUPS) without ever saving files to disk.

Features

  • Zero Footprint (In-Memory Printing): Documents are decoded in RAM and piped directly to stdin of the OS print command. No temporary files are created, ensuring maximum data privacy (GDPR compliant).
  • PDF and ZPL support: Handles standard PDF documents as well as ZPL label files (sent raw to label printers such as Zebra).
  • High Security:
    • Validates magic bytes: %PDF for PDF files, ^XA for ZPL files.
    • Uses strict Base64 decoding.
    • Prevents OS Command Injection by executing subprocesses safely without shell=True.
  • Configurable Channel: Subscribe to any Odoo Bus channel via environment variable or CLI argument, allowing multiple clients to listen on different channels simultaneously.
  • Resilient Connection: Sends WebSocket keepalive pings during idle periods (so proxies and NAT devices do not drop the connection) and reconnects automatically. The reconnection backoff resets after every successful connection, so a server-side disconnect is recovered within seconds, and every reconnection resumes from the last bus notification received, so the print jobs sent while the client was disconnected are delivered instead of lost.
  • Firewall Friendly: Uses WebSockets to initiate an outbound connection to Odoo. No inbound ports need to be opened on the client's local network.
  • Environment Variables (.env): Securely manage Odoo credentials without hardcoding them.

Prerequisites

  • Linux OS (Ubuntu, Debian, etc.)
  • CUPS (Common UNIX Printing System) installed and running. The lp command must be available in the system path.
  • Python 3.7+

Installation

From PyPI

pip install odoo-print-client

From source

  1. Clone the repository and navigate into it:
    git clone https://github.com/forgeflow/odoo-print-client.git
    cd odoo-print-client
    
  2. (Optional but recommended) Create and activate a virtual environment:
    python3 -m venv venv
    source venv/bin/activate
    
  3. Install the package:
    pip install -e .
    

Configuration

Create a .env file in the directory from which you will run the client:

ODOO_URL=http://localhost:8069
ODOO_DB=your_database_name
ODOO_USER=print_service_user
ODOO_PASSWORD=your_super_secure_password
ODOO_CHANNEL=your_odoo_channel
# Optional: seconds of inactivity before sending a keepalive ping (default 30)
ODOO_PING_INTERVAL=30

Secure the file so only the owner can read it:

chmod 600 .env

Note: It is highly recommended to create a dedicated Odoo user (e.g., print_service) with minimal access rights solely for authenticating this client, rather than using the admin account.

Usage

Once installed and configured, run:

odoo-printer

The client loads credentials from the .env file, authenticates via JSON-RPC, establishes the WebSocket connection, and listens for incoming print jobs on the configured channel.

CLI arguments

All options can be overridden via command-line arguments:

odoo-printer \
  --url "https://odoo.example.com" \
  --db "prod" \
  --user "print_service" \
  --password "secret" \
  --channel "printer_office_1"
Argument Env variable Description
--url ODOO_URL Odoo base URL
--url-ssl-noverify (OPTIONAL) Odoo base URL - Don't verify SSL certificate (*)
--db ODOO_DB Odoo database name
--user ODOO_USER Odoo username
--password ODOO_PASSWORD Odoo password
--channel ODOO_CHANNEL Odoo Bus channel to subscribe to
--ping-interval ODOO_PING_INTERVAL (OPTIONAL) Seconds of inactivity before sending a WebSocket keepalive ping (default: 30)

(*) Only available at command-line, it's intented to be used for testing purposes

Running multiple instances

To serve multiple printers or locations, run one instance per channel with different .env files or by passing --channel directly:

odoo-printer --channel "printer_warehouse" &
odoo-printer --channel "printer_office" &

How it works (Odoo side)

This client expects a specific JSON payload sent through bus.bus on the configured channel. You will need a custom Odoo module to intercept the print action and send the payload.

Bus message structure

{
  "type": "print_job",
  "payload": {
    "printer_name": "Name_of_CUPS_Printer",
    "file_type": "pdf",
    "file_data": "JVBERi0xLjQKJcOkw7zDts..."
  }
}
Field Required Values Description
printer_name No Any CUPS printer name Omit to use the system default printer
file_type No pdf (default), zpl Determines how the file is processed
file_data Yes Base64 string Strictly Base64-encoded file content

PDF jobs

Validated against the %PDF magic bytes and sent to CUPS via lp.

ZPL jobs

Validated against the ^XA ZPL start-of-label marker and sent to CUPS via lp -o raw, bypassing raster processing so the raw ZPL stream reaches the label printer directly.

License

LGPL-3.0

Metadata

Release files for odoo-print-client 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for odoo-print-client 1.1.0
File Size Uploaded Provenance Actions
odoo_print_client-1.1.0.tar.gz 11.7 kB Without provenance Details for odoo_print_client-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for odoo-print-client 1.1.0
File Interpreter ABI Platform Actions
odoo_print_client-1.1.0-py3-none-any.whl Python 3 none any Details for odoo_print_client-1.1.0-py3-none-any.whl

Total release size: 22.6 kB

Release files / odoo_print_client-1.1.0.tar.gz

Download URL odoo_print_client-1.1.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
71592b7a9d8a5b28a0ba61698ab13f638d746dad756d61cb58528437286187ce
BLAKE2b-256 checksum
How to use checksums
228265c4e99268dc0cde22eed818eb7e2af0b25b742bdaaa9e972146d140e224
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / odoo_print_client-1.1.0-py3-none-any.whl

Download URL odoo_print_client-1.1.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15d989b4747ac695ecdebf4cd7ea18acd2fc6e061cb522a1c364298488c02b85
BLAKE2b-256 checksum
How to use checksums
f0e0e298f04d8dfb5e68cd852cf60273f9bba45377b928b207903214bfc5a6b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for odoo-print-client 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page