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:

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.