diff options
| author | Gert Pellin <gpe@odoo.com> | 2018-11-21 15:30:04 +0000 |
|---|---|---|
| committer | Gert Pellin <gpe@odoo.com> | 2018-11-21 15:35:39 +0000 |
| commit | 4629a4fb0eacedb024562ef5542011d2e0b2c1f4 (patch) | |
| tree | bbdd21ab62e8d298327b9807210c9941dce9657f /addons | |
| parent | 2643e851aafe20bc84b4f0efc56ac3901373062f (diff) | |
[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
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/point_of_sale/static/src/js/screens.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 8b1b001c340..7c1cb9559a6 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -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() { |
