From 7279f740cdcab9b0fbc423a53eb7e53bd3d0a0f7 Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Wed, 3 Jun 2026 20:17:04 +0700 Subject: [PATCH] fix: wrap order.change access in try-catch to prevent crash on missing rounding_method --- static/src/js/pos_receipt_printer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/src/js/pos_receipt_printer.js b/static/src/js/pos_receipt_printer.js index b9343b0..1ed3912 100755 --- a/static/src/js/pos_receipt_printer.js +++ b/static/src/js/pos_receipt_printer.js @@ -899,7 +899,13 @@ patch(PosPrinterService.prototype, { paymentAmount = typeof order.amountPaid === 'number' ? order.amountPaid : total; } - const change = typeof order.change === 'number' ? Math.max(0, order.change) : 0; + let change = 0; + try { + // Accessing order.change might throw if rounding_method is undefined in config + change = typeof order.change === 'number' ? Math.max(0, order.change) : 0; + } catch (error) { + console.warn('[BluetoothPrint] Error accessing order.change (likely asymmetricRound issue):', error); + } const paymentData = { method: paymentMethod, amount: paymentAmount, change };