[IMP] point_of_sale: more informative error

The pos loading crashes in the following scenario.
1. start selling a product (order line the localstorage)
2. archive or delete the product in backend
3. reload the pos session

The POS is interrupted with not much information.
Give an error a bit more meaningful.
This commit is contained in:
Martin Trigaux
2016-12-15 14:41:37 +01:00
parent 8d43fc46f2
commit e0c9b9c2cd
+2 -1
View File
@@ -1081,7 +1081,8 @@ exports.Orderline = Backbone.Model.extend({
init_from_JSON: function(json) {
this.product = this.pos.db.get_product_by_id(json.product_id);
if (!this.product) {
console.error('ERROR: attempting to recover product not available in the point of sale');
console.error('ERROR: attempting to recover product ID', json.product_id,
'not available in the point of sale. Correct the product or clean the browser cache.');
}
this.price = json.price_unit;
this.set_discount(json.discount);