From 3b610f081d1ee4378ca34b099dac8951edfa563e Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Tue, 16 Nov 2021 15:59:25 +0100 Subject: [PATCH] [FIX] base_report_to_printer: error printing in external network. Error code: 1030, 'The printer or class does not exist.')". An explicit call to `setServer` and `setPort` fixed the issue. (see https://github.com/OpenPrinting/pycups/issues/30) Also, added serve_id to printer views --- base_report_to_printer/models/printing_server.py | 7 +++++++ base_report_to_printer/views/printing_printer.xml | 2 ++ 2 files changed, 9 insertions(+) diff --git a/base_report_to_printer/models/printing_server.py b/base_report_to_printer/models/printing_server.py index 6ae2c6c14f3..ad1ef8c2827 100644 --- a/base_report_to_printer/models/printing_server.py +++ b/base_report_to_printer/models/printing_server.py @@ -36,6 +36,13 @@ def _open_connection(self, raise_on_error=False): self.ensure_one() connection = False try: + # Sometimes connecting to printer servers outside of the local network + # can result in a weird error "cups.IPPError: (1030, 'The printer + # or class does not exist.')". + # An explicit call to `setServer` and `setPort` fixed the issue. + # (see https://github.com/OpenPrinting/pycups/issues/30) + cups.setServer(self.address) + cups.setPort(self.port) connection = cups.Connection(host=self.address, port=self.port) except Exception: message = _( diff --git a/base_report_to_printer/views/printing_printer.xml b/base_report_to_printer/views/printing_printer.xml index 27e52107a49..379aedd0cbe 100644 --- a/base_report_to_printer/views/printing_printer.xml +++ b/base_report_to_printer/views/printing_printer.xml @@ -47,6 +47,7 @@ + @@ -100,6 +101,7 @@ +