[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 <pim@odoo.com>
This commit is contained in:
rhe-odoo
2021-12-20 10:49:52 +00:00
parent 70c12c5790
commit 27e65db56f
@@ -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)) {