Odoo Automatic Printing: Send Invoices to Local Printers
Connect Odoo invoices to local printers without browser print dialogs. Learn how to render reports, queue durable print requests, and deliver them through PrintScaler.
By the PrintScaler team · · 10 min read
Odoo automatic printing requires a server-side workflow: generate the document, select a printer, and submit a print request without asking someone to open a PDF. With PrintScaler, your Odoo integration sends an HTTPS request while an agent on a local computer delivers the document to the physical printer. The important part is coordinating that request with Odoo’s transactions so failed saves, retries, and repeated user actions do not create unwanted paper copies.
How Odoo automatic printing works
An Odoo server can generate an invoice PDF, but that does not automatically give it access to a printer inside your office. This is especially relevant when Odoo runs on hosted infrastructure and the printer sits behind a router on a private network.
A practical architecture separates the business event from printer delivery:
- Odoo posts an invoice or completes another eligible business action.
- Your integration creates a durable print task.
- A background worker generates or retrieves the PDF.
- The worker submits it to the PrintScaler API.
- The PrintScaler agent delivers it to the selected local printer.
- Your integration records submission results and follows the print job’s status.
This is a custom integration pattern, not a claim that PrintScaler includes a prebuilt Odoo connector. You supply the Odoo automation and business rules; PrintScaler supplies the printing API and local delivery connection.
Choose the right printing trigger
Start with one document and one event. For example: print one customer invoice when it first reaches the posted state.
Do not automatically print whenever someone opens, downloads, or previews the report. Those actions can happen repeatedly without representing a new business event.
| Document | Possible trigger | Decision to define first |
|---|---|---|
| Customer invoice | Invoice becomes posted | Which companies and invoice types qualify? |
| Delivery slip | Delivery reaches the required completed state | Should partial deliveries print separately? |
| Packing document | Warehouse operation becomes ready | Which warehouse owns the printer? |
| Credit note | Credit note becomes posted | Is a physical copy actually required? |
Each workflow needs its own eligibility rules. This tutorial uses posted customer invoices to keep the implementation focused.
Check your Odoo hosting and customization options
The implementation below assumes a deployment where you can install a custom server-side module, such as an appropriately configured Odoo.sh or self-hosted installation. Do not assume that an Odoo Online subscription supports installing arbitrary Python modules.
If your environment does not permit custom modules, investigate an external integration using the APIs available for your Odoo version and subscription. It still needs an authorized way to detect eligible records and retrieve their PDFs. The exact report-access mechanism must be verified rather than inferred from a report URL copied from your browser.
Before building, confirm:
- Your Odoo version and deployment type.
- Permission to add server-side code or use the required external APIs.
- The invoice report action used by your installation.
- Which company, warehouse, or workstation determines the printer.
- Whether printing is mandatory or an optional operational convenience.
Test against a staging database first. A working automation can otherwise print historical invoices if its initial search is too broad.
Step 1: Connect the local printer to PrintScaler
Install the PrintScaler agent on a Windows, macOS, Linux, or Raspberry Pi computer that can access the printer. Link that computer by entering the dashboard pairing code, then use the dashboard’s test-page button to verify the printer.
The agent starts automatically after reboots and connects outward over WebSocket. For this setup, you do not need to expose the printer through port forwarding or open an inbound firewall port.
Check the local basics before involving Odoo:
- The operating system can print to the device.
- The correct driver and paper size are selected.
- The agent reports the intended printer.
- A dashboard test page reaches that printer successfully.
Record its PrintScaler printer ID. Your server will use this ID rather than an operating-system printer name.
For ordinary invoices, use an office printer with the appropriate A4 or Letter paper configuration. Do not assume a thermal label printer can sensibly print a full-page invoice.
Step 2: Map Odoo records to approved printers
A printer ID should come from server-side configuration, not an untrusted value submitted by a browser.
For a single office, one company-level invoice printer may be enough. For several locations, store an explicit mapping such as:
| Odoo context | Document purpose | Configured destination |
|---|---|---|
| Company A | Customer invoice | Accounts office printer |
| Company B | Customer invoice | Branch office printer |
| Warehouse East | Delivery document | Dispatch desk printer |
Keep these mappings separate from the invoice itself, while recording the resolved destination on each queued print task. That gives you a useful historical answer to “Where was this invoice supposed to print?” even after configuration changes.
Fail clearly when a mapping is missing. Silently choosing the first available printer can send financial documents to the wrong office.
For a more detailed routing design, see the guide to routing print jobs across multiple locations.
Step 3: Render the Odoo invoice as a PDF
Use Odoo’s reporting engine rather than printing a screenshot or automating a browser session. Inside a custom module, an invoice helper can look like this:
from odoo import models
from odoo.exceptions import UserError
class AccountMove(models.Model):
_inherit = "account.move"
def _printscaler_invoice_pdf(self):
self.ensure_one()
if self.state != "posted" or self.move_type != "out_invoice":
raise UserError("Only posted customer invoices are eligible.")
pdf_bytes, _ = self.env["ir.actions.report"]._render_qweb_pdf(
"account.account_invoices",
res_ids=self.ids,
)
return pdf_bytes
This illustrates a common Odoo report-rendering pattern; it is not a complete installable module. Verify the report external ID and rendering method signature against your installed version. Custom invoice reports may require a different report reference, and multi-company layouts need testing in the intended company context.
The method returns PDF bytes. Your integration can store those bytes as a protected attachment or generate them when processing the queued task.
Decide whether the document needs a snapshot
If the paper copy must match the document as it existed at the triggering event, preserve that PDF as a snapshot. Regenerating it later could incorporate changed addresses, layouts, or other report inputs.
If regeneration is acceptable, a task can reference the invoice and render it during processing. Either way, make the policy explicit rather than letting worker timing determine the result.
Do not expose invoices through permanently public URLs just to make printing easier. Sending the PDF as base64 avoids requiring PrintScaler to fetch a document from your Odoo instance.
Step 4: Create a durable print task, not an inline network call
It is tempting to submit the print request directly from an override of the invoice posting action. That creates an important failure case: the printer may receive the job, but the surrounding database transaction may later roll back.
Instead, create a print-task record in the same database transaction as the eligible business change. A background process should submit it only after that transaction commits.
A small custom outbox model should track at least:
| Field | Purpose |
|---|---|
| Business record reference | Identifies the source invoice |
| Document purpose | Distinguishes an original from a deliberate reprint |
| Printer ID | Preserves the resolved destination |
| PDF attachment or rendering reference | Identifies the document to send |
| Stable idempotency key | Reuses the same submission identity on retries |
| Local processing state | Tracks pending, processing, submitted, or failed work |
| Attempts and next attempt time | Supports controlled retry scheduling |
| Provider job reference and errors | Supports status tracking and troubleshooting |
These are fields for your integration to implement, not a built-in Odoo or PrintScaler queue schema.
Add a database uniqueness rule for the business event, such as invoice plus document purpose plus original-print version. Otherwise, two invocations can create two separate tasks before either is submitted.
An explicit reprint should create a new task and a new idempotency key. It is a new physical action, not a retry of the original request.
Step 5: Submit the PDF to the printing API
The network portion is a standard HTTPS request. This standalone Python example reads an exported invoice PDF; inside your worker, supply the bytes returned by the Odoo helper instead.
import base64
import os
from pathlib import Path
import requests
def submit_invoice(pdf_bytes, printer_id, task_key, title):
response = requests.post(
"https://api.printscaler.com/v1/printjobs",
headers={
"Authorization": f"Bearer {os.environ['PRINTSCALER_API_KEY']}",
"X-Idempotency-Key": task_key,
},
json={
"printerId": printer_id,
"contentType": "pdf_base64",
"content": base64.b64encode(pdf_bytes).decode("ascii"),
"title": title,
},
timeout=(5, 30),
)
response.raise_for_status()
return response
if __name__ == "__main__":
result = submit_invoice(
pdf_bytes=Path("invoice.pdf").read_bytes(),
printer_id=int(os.environ["PRINTSCALER_PRINTER_ID"]),
task_key=os.environ["PRINT_TASK_KEY"],
title="Invoice print test",
)
print(f"Submission returned HTTP {result.status_code}")
Install requests in the environment running this example. Set the API key and printer ID through server-side configuration, and set PRINT_TASK_KEY to a unique value for the test task. Reuse that same value if you retry the same task.
In production, persist the task’s key before making the request. Also capture the returned job reference according to the PrintScaler API documentation, so later state changes can be associated with the correct invoice.
Keep the API key out of browser code, source control, and ordinary logs. Avoid putting unnecessary customer information into job titles.
Configure paper and printing options deliberately
PrintScaler supports PDF options including copies, duplex, paper size, tray, DPI, color, and fit to page. Read the selected printer’s capabilities through the API before configuring device-specific settings.
For the first integration test, use a one-page PDF and a printer with known defaults. Then add the options your workflow requires using the documented request format. Check both A4 and Letter layouts if your companies use different paper standards.
Step 6: Run a background dispatcher safely
An Odoo scheduled action can process pending tasks, or you can operate a separate worker with authorized access to your task store. In either case, keep batches bounded and prevent two workers from processing the same task concurrently.
The dispatcher should:
- Claim an eligible committed task using a concurrency-safe mechanism.
- Load its saved PDF or render the approved report.
- Submit the request with its stored idempotency key.
- Save the response and provider job reference.
- Schedule a retry or flag an actionable failure when necessary.
A timeout does not prove that submission failed. The API might have accepted the request before the response was lost. Retry with the same idempotency key rather than generating another one. The guide to preventing duplicate print jobs explains this distinction in more detail.
Apply exponential backoff with jitter for transient network errors, rate limiting, and appropriate server errors. Do not endlessly retry invalid credentials, invalid printer selections, or malformed requests without correcting their cause.
PrintScaler’s rate limit is 10 requests per second with a burst of 30. A batch posting hundreds of invoices should therefore create queued work, not hundreds of simultaneous HTTP requests.
Track submission separately from printing
An accepted API request is not evidence that a sheet has reached the output tray. Keep local submission state separate from the remote print job’s lifecycle.
PrintScaler job states include new, sent_to_client, queued, in_progress, done, error, cancelled, and expired. Jobs can queue while the agent computer is offline and print when it reconnects, subject to the configured expiration time.
Choose expiration based on the workflow. A delayed invoice might still be useful; an old operational instruction might be misleading by the time it prints.
You can use signed, retried printjob.state webhooks to update your integration. Verify the HMAC-SHA256 signature and process repeated deliveries safely. Do not describe a reported completion state as independent physical proof that every page was readable or collected by the right person.
For operators, show a small set of clear statuses: waiting to submit, submitted, reported complete, or needs attention. Include the printer destination and an authorized reprint action.
Test failure cases before enabling every invoice
A successful single print is only the first test. Run this checklist with non-sensitive sample documents:
- Repeated trigger: the same invoice event creates only one original-print task.
- Transaction rollback: a failed business operation leaves no committed task to print.
- Lost response: retrying uses the existing idempotency key.
- Offline computer: the job waits and follows the chosen expiration policy.
- Invalid mapping: processing stops with a clear error instead of selecting another printer.
- Multiple companies: each invoice uses the correct report context and destination.
- Concurrent workers: one task is not independently dispatched twice with different keys.
- Deliberate reprint: an authorized new task produces another copy and leaves an audit trail.
Initially restrict automation to a test company or a narrowly defined set of invoices. When enabling production, establish a clear cutoff so the worker does not discover and print your entire posted-invoice history.
PrintScaler pricing is per print request, not per page. The Free plan includes 100 prints per month and one connected computer, which can be useful for a limited pilot. Check the current plans before estimating production volume, especially if documents require separate requests or frequent reprints.
Build one reliable invoice workflow first
Reliable Odoo automatic printing combines three things: an explicit business trigger, a durable task with a stable retry identity, and a verified local printer connection. Once that path works, you can extend the same architecture to delivery documents and other reports without tying printing to browser sessions.
Create a free PrintScaler account, connect one printer, and test a single invoice PDF before enabling automatic dispatch.
Frequently asked questions
Can Odoo print invoices automatically without a print dialog?
Yes. A server-side integration can render the invoice PDF and submit it to a printing API after a defined business event, such as invoice posting. With PrintScaler, a local agent delivers the document to the selected printer without requiring a browser print dialog.
Does PrintScaler have a native Odoo connector?
This workflow uses a custom integration with PrintScaler's REST API, not a prebuilt Odoo connector. You implement the Odoo trigger, report generation, printer mapping, and task processing.
Can I use this automatic printing approach with Odoo Online?
The custom Python module approach requires a deployment that permits installing server-side modules. For Odoo Online, verify the external API access and document retrieval options available for your version and subscription before designing an external worker.
What happens if the printer's computer is offline?
PrintScaler jobs can queue while the agent computer is offline and print when it reconnects, subject to their configured expiration time. Your integration should track job status and distinguish accepted submissions from completed printing.
How do I prevent duplicate invoice prints in Odoo?
Create one durable task per intended business event and enforce that uniqueness in your database. Give the task a persistent X-Idempotency-Key and reuse it for submission retries; create a new task and key only for an intentional reprint.
Do invoice PDFs need to be publicly accessible?
No. You can send the PDF bytes using the pdf_base64 content type, so PrintScaler does not need to retrieve the invoice from a public Odoo URL. Protect API credentials and document storage on your own server.