Metadata-Version: 2.1
Name: odoo-addon-base_report_to_printer_websocket
Version: 19.0.1.0.0.4
Requires-Dist: odoo-addon-base_report_to_printer==19.0.*
Requires-Dist: odoo==19.0.*
Summary: Report to printer via WebSocket
Home-page: https://github.com/OCA/report-print-send
License: AGPL-3
Author: ForgeFlow,Dixmit,Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 19.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

===============================
Report to printer via WebSocket
===============================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:de258c1feb02104fc70ac810fb99f19a11714bb4f55aad6173beddebecef3573
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freport--print--send-lightgray.png?logo=github
    :target: https://github.com/OCA/report-print-send/tree/19.0/base_report_to_printer_websocket
    :alt: OCA/report-print-send
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/report-print-send-19-0/report-print-send-19-0-base_report_to_printer_websocket
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/report-print-send&target_branch=19.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

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**

.. contents::
   :local:

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 <https://github.com/OCA/report-print-send/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 <https://github.com/OCA/report-print-send/issues/new?body=module:%20base_report_to_printer_websocket%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* ForgeFlow
* Dixmit

Contributors
------------

- `ForgeFlow <https://forgeflow.com>`__:

  - David Jiménez david.jimenez@forgeflow.com

- `Dixmit <https://dixmit.com>`__:

  - Enric Tobella

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

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 <https://github.com/OCA/report-print-send/tree/19.0/base_report_to_printer_websocket>`_ project on GitHub.

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