From c6a28b627cbe6f8bd1da4321c1329cbc1bde498d Mon Sep 17 00:00:00 2001
From: Antoine Prieels <anp@odoo.com>
Date: Wed, 27 Nov 2019 09:18:33 +0000
Subject: [PATCH] [FIX] hw_drivers: Print status ESC/POS printers

The status ticket contains ESC/POS commands but was printed on all
printers connected in USB. Plugging a printer that doesn't support
ESC/POS resulted in undefined behaviors.

We now only print this status ticket on ESC/POS printers.

closes odoo/odoo#40923

Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
---
 addons/hw_drivers/drivers/PrinterDriver.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/hw_drivers/drivers/PrinterDriver.py b/addons/hw_drivers/drivers/PrinterDriver.py
index 6eb216320253..daca2f5fa185 100644
--- a/addons/hw_drivers/drivers/PrinterDriver.py
+++ b/addons/hw_drivers/drivers/PrinterDriver.py
@@ -87,7 +87,7 @@ class PrinterDriver(Driver):
             'reason': None,
         }
         self.send_status()
-        if 'direct' in self._device_connection:
+        if 'direct' in self._device_connection and 'CMD:ESC/POS;' in self.dev['device-id']:
             self.print_status()
 
     @classmethod
-- 
GitLab