From ed9f5debbea67c6f9e233d6a1183af692f97d362 Mon Sep 17 00:00:00 2001 From: "Pedram (pebr)" Date: Wed, 14 Feb 2024 17:17:58 +0100 Subject: [PATCH] [FIX] point_of_sale: enable automatic web printing without printer Prior to this commit, automatic printing was only functional when a printer was configured with the Point of Sale. It did not support web printing. This commit rectifies this issue, allowing automatic printing to work seamlessly with or without a physical printer setup, supporting web printing. opw-3706400 closes odoo/odoo#154066 Signed-off-by: Joseph Caburnay (jcb) --- .../app/screens/payment_screen/payment_screen.js | 14 +++++++++----- .../screens/receipt_screen/receipt_screen.scss | 15 ++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/addons/point_of_sale/static/src/app/screens/payment_screen/payment_screen.js b/addons/point_of_sale/static/src/app/screens/payment_screen/payment_screen.js index b302ff112c4..f4c171503f6 100644 --- a/addons/point_of_sale/static/src/app/screens/payment_screen/payment_screen.js +++ b/addons/point_of_sale/static/src/app/screens/payment_screen/payment_screen.js @@ -355,11 +355,15 @@ export class PaymentScreen extends Component { ? this.currentOrder.finalized : true; - if (this.hardwareProxy.printer && invoiced_finalized) { - const printResult = await this.printer.print(OrderReceipt, { - data: this.pos.get_order().export_for_printing(), - formatCurrency: this.env.utils.formatCurrency, - }); + if (invoiced_finalized) { + const printResult = await this.printer.print( + OrderReceipt, + { + data: this.pos.get_order().export_for_printing(), + formatCurrency: this.env.utils.formatCurrency, + }, + { webPrintFallback: true } + ); if (printResult && this.pos.config.iface_print_skip_screen) { this.pos.removeOrder(this.currentOrder); diff --git a/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt_screen.scss b/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt_screen.scss index 6f3d8e2e503..6ca053482a1 100644 --- a/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt_screen.scss +++ b/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt_screen.scss @@ -20,17 +20,12 @@ .pos, .pos * { position: static !important; } - .pos .receipt-screen .pos-receipt-container { - position: absolute !important; - top: 0; - left: 0; - } - .pos .receipt-screen .pos-receipt-container, .pos .receipt-screen .pos-receipt-container *, .render-container * { + .render-container .pos-receipt * { visibility: visible; background: white !important; color: black !important; } - .pos .pos-receipt { + .render-container .pos-receipt { margin: 0 !important; margin-left: auto !important; margin-right: auto !important; @@ -43,7 +38,9 @@ top: 10px; left: 10px; } - .o-main-components-container { - display: none; + .o-main-components-container { + position: absolute !important; + top: 0; + left: 0; } }