[FIX] point_of_sale: prevent pos from crashing with archived product
Current behavior: If you create an order in a PoS then go in the backend and archive any of the product in the order. If you try to go back in the PoS session it will crash Steps to reproduce: - Open PoS session and create an order with some products - Leave the session and archive atleast one of these products - Go back to the session, the session crash opw-2854018 closes odoo/odoo#92248 X-original-commit: 0a01e0b97f96754ac2ae84da207584b6b6860b0e Signed-off-by: Masereel Pierre <pim@odoo.com> Signed-off-by: Engels Robin (roen) <roen@odoo.com>
This commit is contained in:
@@ -2199,7 +2199,9 @@ class Order extends PosModel {
|
||||
var orderlines = json.lines;
|
||||
for (var i = 0; i < orderlines.length; i++) {
|
||||
var orderline = orderlines[i][2];
|
||||
this.add_orderline(Orderline.create({}, {pos: this.pos, order: this, json: orderline}));
|
||||
if (this.pos.db.get_product_by_id(orderline.product_id)) {
|
||||
this.add_orderline(Orderline.create({}, { pos: this.pos, order: this, json: orderline }));
|
||||
}
|
||||
}
|
||||
|
||||
var paymentlines = json.statement_ids;
|
||||
|
||||
Reference in New Issue
Block a user