diff options
| author | Lucas Perais (lpe) <lpe@odoo.com> | 2018-06-22 16:42:29 +0200 |
|---|---|---|
| committer | Lucas Perais (lpe) <lpe@odoo.com> | 2018-06-25 09:15:12 +0200 |
| commit | 786c044a39a3bd472af18db73e21ef32eb20b021 (patch) | |
| tree | 727783251a9681cd40136c9722a2d3d6447699c0 /addons/pos_restaurant/static/src/js/multiprint.js | |
| parent | 8e9936ba04e32207e5b1d494419c3c25b1351d5b (diff) | |
[FIX] pos_restaurant: don't crash when printer have no url set
Have a printer in a pos.config that doesn't have a url set
Open the pos
Before this commit, there was a JS traceback, since we tried to call
string operation on undefined.
After this commit, we avoid the traceback with a behavior that *looks like* the v9.0's
i.e. we don't care if the url actually means something, we put a message in the console though
OPW 1858063
closes #25442
Diffstat (limited to 'addons/pos_restaurant/static/src/js/multiprint.js')
| -rw-r--r-- | addons/pos_restaurant/static/src/js/multiprint.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/pos_restaurant/static/src/js/multiprint.js b/addons/pos_restaurant/static/src/js/multiprint.js index 65956ffa66d..5270f103c48 100644 --- a/addons/pos_restaurant/static/src/js/multiprint.js +++ b/addons/pos_restaurant/static/src/js/multiprint.js @@ -29,8 +29,10 @@ var Printer = core.Class.extend(mixins.PropertiesMixin,{ self.connection.rpc('/hw_proxy/print_xml_receipt',{receipt: r},{timeout: 5000}) .then(function(){ send_printing_job(); - },function(){ + },function(error, event){ self.receipt_queue.unshift(r); + console.log('There was an error while trying to print the order:'); + console.log(error); }); } } @@ -54,7 +56,7 @@ models.load_models({ for(var i = 0; i < printers.length; i++){ if(active_printers[printers[i].id]){ - var url = printers[i].proxy_ip; + var url = printers[i].proxy_ip || ''; if(url.indexOf('//') < 0){ url = 'http://'+url; } |
