[REM] hw_drivers: Remove printers list from status

The status returned bby PrinterDriver contained a list of connected
printers to be used in Enterprise, to determine if the printer that was
selected in POS Config was used in the POS. We now read this status
from the db and we therefore don't need this anymore.

In Community the user only needs to know if there's a printer connected
to the Box. We just have to know if any printer is present.

TaskID: 1970884
This commit is contained in:
Antoine Prieels
2019-09-17 08:31:32 +00:00
parent 88c91a1e88
commit 7cb540b485
+3 -15
View File
@@ -75,7 +75,6 @@ bus.add_signal_receiver(cups_notification_handler, signal_name="PrinterStateChan
class PrinterDriver(Driver):
connection_type = 'printer'
status = {'status': "disconnected", 'printers': [], 'messages': []}
def __init__(self, device):
super(PrinterDriver, self).__init__(device)
@@ -88,8 +87,7 @@ class PrinterDriver(Driver):
'reason': None,
}
self.send_status()
if 'direct' in self._device_connection or helpers.get_odoo_server_url():
self.add_connected_printer()
if 'direct' in self._device_connection:
self.print_status()
@classmethod
@@ -137,22 +135,13 @@ class PrinterDriver(Driver):
@classmethod
def get_status(cls):
return cls.status
status = 'connected' if any(iot_devices[d].device_type == "printer" and iot_devices[d].device_connection == 'direct' for d in iot_devices) else 'disconnected'
return {'status': status, 'messages': ''}
@property
def device_identifier(self):
return self.dev['identifier']
def add_connected_printer(self):
PrinterDriver.status['status'] = "connected"
PrinterDriver.status['printers'].append(self.device_identifier)
def remove_connected_printer(self):
if self.device_identifier in PrinterDriver.status['printers']:
PrinterDriver.status['printers'].remove(self.device_identifier)
if not PrinterDriver.status['printers']:
PrinterDriver.status['status'] = "disconnected"
def action(self, data):
if data.get('action') == 'cashbox':
self.open_cashbox()
@@ -162,7 +151,6 @@ class PrinterDriver(Driver):
self.print_raw(b64decode(data['document']))
def disconnect(self):
self.remove_connected_printer()
self.update_status('disconnected', 'Printer was disconnected')
super(PrinterDriver, self).disconnect()