Skip to main content

Report to printer via WebSocket

Project description

Odoo Community Association

Report to printer via WebSocket

Beta License: AGPL-3 OCA/report-print-send Translate me on Weblate Try me on Runboat

This module extends base_report_to_printer to send print jobs through the Odoo Bus (WebSocket) instead of a traditional print server like CUPS.

When a report is printed, the module encodes the rendered PDF in Base64 and sends a print_job message through the bus to the user configured on the printer. A client-side listener running as that user receives the payload and forwards it to the local printer.

Main features:

  • No external print server required — works over the existing Odoo Bus.

  • Sends print jobs as Base64-encoded PDFs via WebSocket.

  • Each printer is bound to a specific Odoo user, so jobs are delivered only to the right client-side agent.

  • Compatible with the standard base_report_to_printer configuration (global, per user, per report, per user + report).

  • Works with odoo-print-client <https://pypi.org/project/odoo-print-client/>_ as the client-side agent to receive and print jobs.

Table of contents

Configuration

  1. Create a printer record in Settings > Printing > Printers with the backend set to WebSocket.

  2. Set the System Name to the name of the target printer as known by the client-side listener (e.g. MFC-L3750CDW). Leave it empty to use the default system printer.

  3. Set the WebSocket User to the Odoo user that will run the odoo-print-client agent. Print jobs are delivered through the bus subscription of this user.

  4. Assign the printer as the default globally, per user, or per report following the standard base_report_to_printer workflow.

  5. Install and run the odoo-print-client agent on the machine connected to the printer

    pip install odoo-print-client
    odoo-printer --url "https://odoo.example.com" --db "prod" --user "admin" --password "admin"

    See odoo-print-client on PyPI <https://pypi.org/project/odoo-print-client/>_ for full configuration options.

Usage

Once configured, printing works transparently. When a user prints a report that is set to Send to Printer and the assigned printer uses the WebSocket backend, the module will:

  1. Render the report as PDF.

  2. Encode the PDF content in Base64.

  3. Send a print_job message through the bus to the printer’s configured user with the following payload

    {
        "printer_name": "<system_name of the printer>",
        "file_data": "<base64-encoded PDF>"
    }

The recommended client-side agent is odoo-print-client <https://pypi.org/project/odoo-print-client/>_, which connects as the configured user and forwards jobs to the local printer.

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • ForgeFlow

  • Dixmit

Contributors

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

This module is part of the OCA/report-print-send project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file odoo_addon_base_report_to_printer_websocket-19.0.1.0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addon_base_report_to_printer_websocket-19.0.1.0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7b57d0d4763069b2eb907df4633e4d3e9e1f20ca8b3f7c5e08502e6739960bd9
MD5 9d25d7af5350e80df8d5a40aefac1cef
BLAKE2b-256 010efcc8c0b3a18bbaa0802c12f1e96a406e5c29b1d9d22ce9565f27a8fb9e63

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page