refactor: update order retrieval method and remove redundant pos service reference in receipt printer logic

This commit is contained in:
Suherdy Yacob 2026-06-03 11:42:55 +07:00
parent 2397c6dcb3
commit 923671cc56

View File

@ -110,7 +110,7 @@ patch(PosPrinterService.prototype, {
// Determine print context // Determine print context
const pos = this.env?.services?.pos; const pos = this.env?.services?.pos;
const currentPrintContext = pos?.hardwareProxy?.currentPrintContext; const currentPrintContext = pos?.hardwareProxy?.currentPrintContext;
const order = this._currentPrintOrder || currentPrintContext?.order || pos?.get_order(); const order = this._currentPrintOrder || currentPrintContext?.order || pos?.getOrder();
let printType = currentPrintContext?.printType; let printType = currentPrintContext?.printType;
if (!printType) { if (!printType) {
@ -130,7 +130,6 @@ patch(PosPrinterService.prototype, {
const storage = new BluetoothPrinterStorage(); const storage = new BluetoothPrinterStorage();
// Get POS config ID dynamically from POS store service // Get POS config ID dynamically from POS store service
const pos = this.env?.services?.pos;
const posConfigId = pos?.config?.id || 1; const posConfigId = pos?.config?.id || 1;
// Check if user has explicitly bypassed bluetooth printer for this device // Check if user has explicitly bypassed bluetooth printer for this device