From 15f6397ff266353dacdfb6604ee45323968e115e Mon Sep 17 00:00:00 2001 From: "Loan (lse)" Date: Wed, 1 Jun 2022 15:59:36 +0000 Subject: [PATCH] [IMP] pos_epson: Better error message on PoS start Chrome did an update on which LAN devices are not accessible trough websites (but would still be accessible in `localhost`) ending in CORS error when trying to reach the device. More information: https://developer.chrome.com/blog/private-network-access-update/ Before this commit: A lot of customers were confused as of why their printers suddently stop working without any changes. After this commit: The error message have been improved to also guide people to solve this issue (creating an HTTPS certificate). Note that it is not possible from the JS code to say if they are concerned by this issue or not as the error given does not specify explicitly if it is a CORS error or something else, see: https://stackoverflow.com/a/6734427 OPW-2850019 & many more like: OPW-2856164 OPW-2858658 OPW-2857076 closes odoo/odoo#93764 X-original-commit: e97b14f2bfe3d8b096b42c6bc3cf35537367aff7 Signed-off-by: Quentin Lejeune (qle) --- addons/point_of_sale/static/src/js/printers.js | 6 +++++- addons/pos_epson_printer/static/src/js/printers.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/printers.js b/addons/point_of_sale/static/src/js/printers.js index 8119606bbcb..4eb6ea64303 100644 --- a/addons/point_of_sale/static/src/js/printers.js +++ b/addons/point_of_sale/static/src/js/printers.js @@ -30,7 +30,11 @@ class PrintResultGenerator { successful: false, message: { title: _t('Connection to the printer failed'), - body: _t('Please check if the printer is still connected.'), + body: _t('Please check if the printer is still connected. \n' + + 'Some browsers don\'t allow HTTP calls from websites to devices in the network (for security reasons). ' + + 'If it is the case, you will need to follow Odoo\'s documentation for ' + + '\'Self-signed certificate for ePOS printers\' and \'Secure connection (HTTPS)\' to solve the issue' + ), }, }); } diff --git a/addons/pos_epson_printer/static/src/js/printers.js b/addons/pos_epson_printer/static/src/js/printers.js index 72a855963d3..05b304f710c 100644 --- a/addons/pos_epson_printer/static/src/js/printers.js +++ b/addons/pos_epson_printer/static/src/js/printers.js @@ -19,7 +19,11 @@ class EpsonPrintResultGenerator extends PrintResultGenerator { successful: false, message: { title: _t('Connection to the printer failed'), - body: _t('Please check if the printer is still connected.'), + body: _t('Please check if the printer is still connected. \n' + + 'Some browsers don\'t allow HTTP calls from websites to devices in the network (for security reasons). ' + + 'If it is the case, you will need to follow Odoo\'s documentation for ' + + '\'Self-signed certificate for ePOS printers\' and \'Secure connection (HTTPS)\' to solve the issue' + ), } });