[FIX] point_of_sale: add error message when image are not loaded
Current behavior: When trying to print a receipt offline, the image will not be loaded and you get a traceback. Now the receipt is printed, and an error is logged in the console if the images couldn't be loaded Steps to reproduce: - Add a logo to the company - Launch PoS - In the browser devtools network tab turn the connection down - Do an order, and try to print the receipt - You get a traceback and the receipt is not printed opw-3811663 closes odoo/odoo#162451 Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
@@ -38,7 +38,11 @@ export class PrinterService {
|
||||
async print(component, props, options) {
|
||||
const el = await this.renderer.toHtml(component, props);
|
||||
// Load all images before printing
|
||||
try {
|
||||
await loadAllImages(el);
|
||||
} catch (e) {
|
||||
console.error("Images could not be loaded correctly", e);
|
||||
}
|
||||
return await this.printHtml(el, options);
|
||||
}
|
||||
is = () => Boolean(this.device?.printReceipt);
|
||||
|
||||
Reference in New Issue
Block a user