Metadata-Version: 2.1
Name: odoo-addon-base_report_to_printer_qztray
Version: 19.0.1.0.1.2
Requires-Dist: odoo-addon-base_report_to_printer==19.0.*
Requires-Dist: odoo==19.0.*
Requires-Dist: pyOpenSSL
Summary: Report to QZ Tray
Home-page: https://github.com/OCA/report-print-send
License: AGPL-3
Author: PESOL, Nagarro, 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 QZ Tray
=================

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

.. |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_qztray
    :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_qztray
    :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|

QZ Tray Printing Backend
========================

This module adds support for printing Odoo reports directly from the
client machine using **QZ Tray** as a printing backend.

It allows reports to be sent securely to locally installed printers
without relying on server-side printing systems such as CUPS. Instead,
printing is handled on the client side through QZ Tray, enabling direct
access to USB, network, or system printers.

This backend is especially useful in environments where client-side
printing is required, such as Point of Sale setups, kiosk systems, or
deployments where the Odoo server does not have access to the printers
used by end users.

**Table of contents**

.. contents::
   :local:

Installation
============

This module requires **QZ Tray** to be installed and properly configured
on the client machine, as well as additional setup on the Odoo server to
enable secure communication.

Prerequisites
-------------

1. Install QZ Tray on the client
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Download and install QZ Tray on every client that will send print jobs:

https://qz.io/download/

Make sure QZ Tray is running before attempting to print from Odoo.

--------------

2. Install pyOpenSSL on the Odoo server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``pyOpenSSL`` is required to sign the messages sent to QZ Tray. This
avoids security warnings and allows trusted communication.

.. code:: bash

   sudo pip3 install pyOpenSSL

If you are using a virtual environment, make sure to install it inside
that environment.

3. Generate a signing certificate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Generate a self-signed certificate that will be used by Odoo to sign QZ
Tray messages.

When prompted for:

.. code:: bash

   Common Name (e.g. server FQDN or YOUR name) []:

You must enter your Odoo domain name.

You can also use a wildcard domain, for example:

::

   *.my-odoo-domain.com

Generate the certificate with:

.. code:: bash

   openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -nodes

This will generate two files:

**cert.pem** → public certificate

**key.pem** → private key

4. Configure the certificate in Odoo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Log in to Odoo with administrator privileges and enable developer mode.
Then go to:

- **Settings -> Technical -> Parameters -> System Parameters**

Create the following parameters:

============== ===============================
**Key**        **Value**
============== ===============================
qz.certificate Content of cert.pem (full text)
qz.key         Content of key.pem (full text)
============== ===============================

Make sure to copy the full contents, including the BEGIN and END lines.

5. Install the certificate in QZ Tray (client side)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On the client machine:

1. Open the QZ Tray menu.

2. Go to Advanced → Site Manager.

3. Drag and drop the cert.pem file into the Site Manager.

4. Ensure the certificate is associated with your Odoo domain.

This step authorizes your Odoo server to send signed print jobs to QZ
Tray.

Notes
~~~~~

- Each client machine must have QZ Tray installed and running.
- The certificate must match the domain used to access Odoo.
- The same certificate can be used in all client machines.
- This module is designed to be backend-agnostic and works together with
  other base_report_to_printer\_\* backends.

Configuration
=============

This document explains how to configure the
**base_report_to_printer_qz** module before using it. It is intended for
users with **administration privileges**.

--------------

1. Configure a Printer Using QZ Tray Backend
--------------------------------------------

The module relies on printers configured in Odoo that use the **QZ Tray
backend**.

Create or Configure a Printer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Go to **Settings → Technical → Printing → Printers**.

2. Click **Create** (or open an existing printer).

3. Configure the printer with the following values:

   - **Name**: Must match **exactly** the printer name installed on the
     client operating system and visible in QZ Tray.
   - **Backend**: Select **QZ Tray**.

..

   The print jobs will be sent to the locally installed printer whose
   name matches the configured printer name in Odoo.

--------------

3. Assign the Printer (Optional but Recommended)
------------------------------------------------

You can define which printer is used by default at different levels.

Per User
~~~~~~~~

1. Go to **Settings → Users & Companies → Users**.
2. Open the user.
3. Set:

   - **Printing Action** (e.g. *Send to Printer*).
   - **Printing Printer** (select the QZ Tray printer created earlier).

4. Save.

Per Report (Optional)
~~~~~~~~~~~~~~~~~~~~~

1. Go to **Settings → Technical → Reports**.
2. Open the report you want to print automatically.
3. Configure:

   - **Printing Action**
   - **Printing Printer**

4. Save.

User-level settings will always take precedence over report-level
settings.

--------------

4. Client-Side Requirements
---------------------------

Ensure the following on each client machine:

- **QZ Tray** is installed and running.
- The client trusts the certificate configured in Odoo.
- The printer is installed locally and its name matches the one
  configured in Odoo.

--------------

Once these steps are completed, reports configured to be sent to the
printer will be printed through **QZ Tray** without further user
interaction.

Usage
=====

Guidelines for use:

   - To print a report on a specific printer or tray, you can change
     these in *Settings > Printing > Reports* to define default
     behaviour.
   - To print a report on a specific printer and/or tray for a user, you
     can change these in *Settings > Printing > Reports* in *Specific
     actions per user*
   - Users may also select a default action, printer or tray in their
     preferences.

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_qztray%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
-------

* PESOL
* Nagarro

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

- Angel Moya <angel.moya@pesol.es>
- Chris Mann <chris.mann@openusersystems.com>
- Miquel Alzanillas <miquel.alzanillas@nagarro.com>

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_qztray>`_ project on GitHub.

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