From 21b5508f301b590882cb9063e93fc762672cafac Mon Sep 17 00:00:00 2001 From: "Loan (LSE)" Date: Fri, 25 Aug 2023 11:17:39 +0000 Subject: [PATCH] [FIX] point_of_sale: cashdrawer does not open in direct device Connecting a cashdrawer to an ePoS printer in direct device ( NOT with an IoT box) will not automatically open the cashdrawer as it would be intended when paying with cash. This happens due to the fact that we check that the printer connection is "connected" which is not the case with direct device as it use the default value in the setup which is "disconnected". opw-3470241 closes odoo/odoo#133216 X-original-commit: 339a76885db0f2034bae21eec76d0127d2733205 Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Loan Sens (lse) --- .../src/app/hardware_proxy/hardware_proxy_service.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/app/hardware_proxy/hardware_proxy_service.js b/addons/point_of_sale/static/src/app/hardware_proxy/hardware_proxy_service.js index 7f9b7bb29a2..c1a0b90f447 100644 --- a/addons/point_of_sale/static/src/app/hardware_proxy/hardware_proxy_service.js +++ b/addons/point_of_sale/static/src/app/hardware_proxy/hardware_proxy_service.js @@ -25,7 +25,7 @@ export class HardwareProxy extends EventBus { this.useDebugWeight = false; this.host = ""; this.keptalive = false; - this.connectionInfo = reactive({ status: "disconnected", drivers: {} }); + this.connectionInfo = reactive({ status: "init", drivers: {} }); effect( (info) => { if (info.status === "connected" && this.printer) { @@ -191,7 +191,11 @@ export class HardwareProxy extends EventBus { return this.message("log", { arguments: [...arguments] }); } async openCashbox(action = false) { - if (this.pos.config.iface_cashdrawer && this.connectionInfo.status === "connected") { + if ( + this.pos.config.iface_cashdrawer && + this.printer && + ["connected", "init"].includes(this.connectionInfo.status) + ) { this.printer.openCashbox(); if (action) { this.pos.logEmployeeMessage(action, "CASH_DRAWER_ACTION");