[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
This commit is contained in:
Lucas Perais (lpe)
2018-06-25 09:15:12 +02:00
parent 8e9936ba04
commit 786c044a39
@@ -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;
}