Metadata-Version: 2.1
Name: odoo-addon-pos_self_service_weighing_print_zpl
Version: 16.0.1.0.0.1
Summary: ZPL print driver for the self-service weighing station
Home-page: https://github.com/OCA/pos
Author: Coop IT Easy SC, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: AGPL-3
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 16.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Requires-Python: >=3.10
Requires-Dist: odoo-addon-base-pos-self-service-weighing<16.1dev,>=16.0dev
Requires-Dist: odoo<16.1dev,>=16.0a

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

======================================
Self-Service Weighing ZPL Print Driver
======================================

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

.. |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%2Fpos-lightgray.png?logo=github
    :target: https://github.com/OCA/pos/tree/16.0/pos_self_service_weighing_print_zpl
    :alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_self_service_weighing_print_zpl
    :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/pos&target_branch=16.0
    :alt: Try me on Runboat

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

ZPL print driver for the self-service weighing station.

This module allows to print barcode labels (generated by the self-service weighing station) using ZPL-compatible printers.

**Table of contents**

.. contents::
   :local:

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

Printer
~~~~~~~

Add printer to the OS.

Browse to the CUPS configuration page to get the name of the printer that will be used: http://localhost:631/printers. Set this name as the printer name in the POS self-service configuration page.

Center the barcode by trial and error using the label offset and size configuration values of the POS self-service configuration page.

Configure printer to accept several jobs in a row::

    lpadmin -p <PRINTERNAME> -o usb-no-reattach-default=true

And restart CUPS to apply the new configuration::

    sudo service cups restart


Reverse proxy with nginx
~~~~~~~~~~~~~~~~~~~~~~~~

Install nginx::

    apt install nginx

Start nginx::

    sudo systemctl start nginx.service

Copy this file in::

    /etc/nginx/sites-available/cups

.. code-block::

    upstream cups-reverse-proxy {
        server 127.0.0.1:631 weight=1 fail_timeout=60s;
    }

    server {
        # server port and name
        listen 8631;
        listen [::]:8631;
        server_name _;

        # ssl log files
        access_log /var/log/nginx/cups-access.log;
        error_log /var/log/nginx/cups-error.log;


        # increase proxy buffer to handle some Odoo web requests
        proxy_buffers 16 64k;
        proxy_buffer_size 128k;

        location / {
            proxy_pass http://cups-reverse-proxy;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Host $server_name;

            add_header 'Access-Control-Allow-Origin' $http_origin always;
            add_header 'Access-Control-Allow-Credentials' * always;
            add_header 'Access-Control-Allow-Methods' * always;
            add_header 'Access-Control-Allow-Headers' * always;
            # required to be able to read Authorization header in frontend
            add_header 'Access-Control-Expose-Headers' * always;

            if ($request_method = 'OPTIONS') {
                # Tell client that this pre-flight info is valid for 20 days
                add_header 'Access-Control-Max-Age' 1728000;
                add_header 'Content-Type' 'text/plain charset=UTF-8';
                add_header 'Content-Length' 0;
                add_header 'Access-Control-Allow-Origin' $http_origin always;
                add_header 'Access-Control-Allow-Credentials' * always;
                add_header 'Access-Control-Allow-Methods' * always;
                add_header 'Access-Control-Allow-Headers' * always;
                # required to be able to read Authorization header in frontend
                add_header 'Access-Control-Expose-Headers' * always;

                return 204;
            }

            # by default, do not forward anything
            proxy_redirect off;
        }
    }

Create symbolic link::

    sudo ln -s /etc/nginx/sites-available/cups /etc/nginx/sites-enabled/

Check the syntax is ok::

    sudo nginx -t
    sudo systemctl restart nginx.service

Usage
=====

Reset a Zebra printer
~~~~~~~~~~~~~~~~~~~~~
`Factory reset video <https://www.youtube.com/watch?v=SXvoW3sm6ls>`_

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/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/pos/issues/new?body=module:%20pos_self_service_weighing_print_zpl%0Aversion:%2016.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
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* `Coop IT Easy SC <https://coopiteasy.be>`_:

  * Grégoire Leeuwerck
  * Vincent Van Rossem
  * hugues de keyzer
* `Le Nid <https://lenid.ch>`_:

  * François Kawala

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/pos <https://github.com/OCA/pos/tree/16.0/pos_self_service_weighing_print_zpl>`_ project on GitHub.

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