From 27e65db56f7d04c38eb6bbde5aef5d18c61be405 Mon Sep 17 00:00:00 2001 From: rhe-odoo Date: Thu, 16 Dec 2021 15:45:30 +0000 Subject: [PATCH] [FIX] point_of_sale: receipt automatic print image fail There were some issues when auto printing the receipt with images. It could happen that the receipt was printed and the image were not yet visible. To fix this, we make sure the image are rendered on the receipt before we print it. closes odoo/odoo#81579 Ticket-id: 2688238 X-original-commit: 10d47ed2aee17f2a0d0b76c49c623fb3da4d5e30 Signed-off-by: Masereel Pierre --- .../static/src/js/Screens/ReceiptScreen/ReceiptScreen.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/Screens/ReceiptScreen/ReceiptScreen.js b/addons/point_of_sale/static/src/js/Screens/ReceiptScreen/ReceiptScreen.js index 3ab04107846..8649f69e97e 100644 --- a/addons/point_of_sale/static/src/js/Screens/ReceiptScreen/ReceiptScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/ReceiptScreen/ReceiptScreen.js @@ -27,7 +27,13 @@ odoo.define('point_of_sale.ReceiptScreen', function (require) { // We are doing this because we want the receipt screen to be // displayed regardless of what happen to the handleAutoPrint // call. - setTimeout(async () => await this.handleAutoPrint(), 0); + setTimeout(async () => { + let images = this.orderReceipt.el.getElementsByTagName('img'); + for(let image of images) { + await image.decode(); + } + await this.handleAutoPrint(); + }, 0); } async onSendEmail() { if (!is_email(this.orderUiState.inputEmail)) {