[FIX] point_of_sale: traceback on printing android

Firefox for android gives atraceback when clicking the print receipt
button. This traceback is caused becaus Firefox for Android does not
support printing.

This fix replaces the traceback by an explanation why it is not possible
to print.

Also  backport for safari-fix

closes odoo/odoo#28919
This commit is contained in:
Gert Pellin
2018-11-21 15:35:39 +00:00
parent 2643e851aa
commit 4629a4fb0e
+16 -1
View File
@@ -1487,7 +1487,22 @@ var ReceiptScreenWidget = ScreenWidget.extend({
}
},
print_web: function() {
window.print();
if ($.browser.safari) {
document.execCommand('print', false, null);
} else {
try {
window.print();
} catch(err) {
if (navigator.userAgent.toLowerCase().indexOf("android") > -1) {
this.gui.show_popup('error',{
'title':_t('Printing is not supported on some android browsers'),
'body': _t('Printing is not supported on some android browsers due to no default printing protocol is available. It is possible to print your tickets by making use of an IoT Box.'),
});
} else {
throw err;
}
}
}
this.pos.get_order()._printed = true;
},
print_xml: function() {