summaryrefslogtreecommitdiff
path: root/addons/hw_escpos
diff options
context:
space:
mode:
authorAntoine Prieels <anp@odoo.com>2020-05-14 07:45:07 +0000
committerAntoine Prieels <anp@odoo.com>2020-08-25 06:19:38 +0000
commit841c016913a87133bf7257c62ae5f6bf7d99e06d (patch)
treeb0ed83f8b440e9920ec32c4dd48818847c4725d6 /addons/hw_escpos
parent6bc4b4178c8033f19f1ed3d7ba22f777ac9b0788 (diff)
[IMP] hw_*,point_of_sale: Cleaning IoT Box
- Split driver.py to multiple files - Remove hw_proxy module as most of its routes were not used and move remaingin routes to a controller in hw_drivers - Add missing coding and license lines at the beginning of files - Reorder imports and remove unused ones - Rename device_id to device_identifier for clarity - Rename screen to display for consistency - Other minors improvements TaskID: 1973956
Diffstat (limited to 'addons/hw_escpos')
-rw-r--r--addons/hw_escpos/__manifest__.py1
-rw-r--r--addons/hw_escpos/controllers/main.py12
2 files changed, 5 insertions, 8 deletions
diff --git a/addons/hw_escpos/__manifest__.py b/addons/hw_escpos/__manifest__.py
index dedb4b6bde9..de2e3d442d5 100644
--- a/addons/hw_escpos/__manifest__.py
+++ b/addons/hw_escpos/__manifest__.py
@@ -16,7 +16,6 @@ to open ESC/POS controlled cashdrawers in the point of sale and other modules
that would need such functionality.
""",
- 'depends': ['hw_proxy'],
'external_dependencies': {
'python' : ['pyusb','pyserial','qrcode'],
},
diff --git a/addons/hw_escpos/controllers/main.py b/addons/hw_escpos/controllers/main.py
index 160cee39342..123a8a41cec 100644
--- a/addons/hw_escpos/controllers/main.py
+++ b/addons/hw_escpos/controllers/main.py
@@ -27,7 +27,7 @@ except ImportError:
usb = None
from odoo import http, _
-from odoo.addons.hw_proxy.controllers import main as hw_proxy
+from odoo.addons.hw_drivers.controllers import proxy
_logger = logging.getLogger(__name__)
@@ -78,10 +78,7 @@ class EscposDriver(Thread):
for printer in printers:
try:
- if usb.__version__ == '1.0.0b1':
- description = usb.util.get_string(printer, 256, printer.iManufacturer) + " " + usb.util.get_string(printer, 256, printer.iProduct)
- else:
- description = usb.util.get_string(printer, printer.iManufacturer) + " " + usb.util.get_string(printer, printer.iProduct)
+ description = usb.util.get_string(printer, printer.iManufacturer) + " " + usb.util.get_string(printer, printer.iProduct)
except Exception as e:
_logger.error("Can not get printer description: %s" % e)
description = 'Unknown printer'
@@ -326,9 +323,10 @@ class EscposDriver(Thread):
driver = EscposDriver()
-hw_proxy.drivers['escpos'] = driver
+proxy.proxy_drivers['escpos'] = driver
+
-class EscposProxy(hw_proxy.Proxy):
+class EscposProxy(proxy.ProxyController):
@http.route('/hw_proxy/open_cashbox', type='json', auth='none', cors='*')
def open_cashbox(self):