From 7c025b2779ccf4bbc0afac414e2be77d79f53d91 Mon Sep 17 00:00:00 2001 From: "Pedram (pebr)" Date: Mon, 5 Feb 2024 16:59:34 +0100 Subject: [PATCH] [FIX] point_of_sale: prevent printing empty page Before this commit, printing a receipt would result in an additional empty page being printed. This not only wasted paper but also caused issues. The problem was related to the notification element on the print page. By removing this element, the issue has been resolved. opw-3706233 closes odoo/odoo#152731 Signed-off-by: Vlad Stroia (vlst) --- .../static/src/app/printer/printer_service.js | 14 +------------- .../app/screens/receipt_screen/receipt_screen.scss | 3 +++ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/addons/point_of_sale/static/src/app/printer/printer_service.js b/addons/point_of_sale/static/src/app/printer/printer_service.js index 112068e0d07..79f93d3c9ed 100644 --- a/addons/point_of_sale/static/src/app/printer/printer_service.js +++ b/addons/point_of_sale/static/src/app/printer/printer_service.js @@ -18,19 +18,7 @@ export class PrinterService { this.device = newDevice; } printWeb(el) { - this.renderer.whenMounted({ - el, - callback: () => { - var orig = document.querySelector(".pos-receipt"); - if (orig) { - orig.style.display = "none"; - } - window.print(); - if (orig) { - orig.style.display = ""; - } - }, - }); + this.renderer.whenMounted({ el, callback: window.print }); return true; } async printHtml(el, { webPrintFallback = false } = {}) { 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 f84e219721b..6f3d8e2e503 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 @@ -43,4 +43,7 @@ top: 10px; left: 10px; } + .o-main-components-container { + display: none; + } }