Hello,
I have deployed Odoo PoS Module with some customization. One of those customization is to load only available products (qty_available>0) but some time (in multi-session) I get this error:
Here is the scenarios
Lets assume there are two users with two different open sessions and a product X with 3 items available qty_available=3
User A adds 3 items of product X to the order
User B adds 1 items of the same product X to his order
User A validates his order
For some reason User B refreshes the browser's tab which will reload the POS but unfortunately the reloading will not succeed (will get stuck at some point)because the order is cached with a product that is no longer available.
In the browser log the following message is displayed:
I have tried to stop the loading the order and its orderlines from the cache with the method init_from_JSON but It is not working yet. This is very annoying for non technical people.
models.Orderline = models.Orderline.extend({
initialize: function(attr,options){
this.pos = options.pos;
this.order = options.order;
if (options.json) {
/*try {
this.init_from_JSON(options.json);
} catch(error) {
console.error('ERROR: attempting to recover product ID', options.json.product_id,
'not available in the point of sale. Correct the product or clean the browser cache.');
console.log(error);
}*/
return;
}
this.product = options.product;
this.set_product_lot(this.product);
this.set_quantity(1);
this.discount = 0;
this.discountStr = '0';
this.selected = false;
this.id = orderline_id++;
this.price_manually_set = false;
if (options.price) {
this.set_unit_price(options.price);
} else {
this.set_unit_price(this.product.get_price(this.order.pricelist, this.get_quantity()));
}
},
});
I am getting errors in some places of the OrderLine Backbone Model
Any help please.
Did anyone find a solution? I got same problem