diff --git a/addons/point_of_sale/static/src/app/store/pos_store.js b/addons/point_of_sale/static/src/app/store/pos_store.js index 01d194f1423..1d6cf5e8f63 100644 --- a/addons/point_of_sale/static/src/app/store/pos_store.js +++ b/addons/point_of_sale/static/src/app/store/pos_store.js @@ -796,6 +796,7 @@ export class PosStore extends Reactive { message = messageFp; } } + await this._getMissingProducts(ordersJson); const allOrders = [...this.get_order_list()]; this._replaceOrders(allOrders, ordersJson); this.sortOrders(); @@ -834,6 +835,17 @@ export class PosStore extends Reactive { [[odoo.pos_session_id], pricelistsToGet] ); } + async _getMissingProducts(ordersJson) { + const productIds = []; + for (const order of ordersJson) { + for (const orderline of order.lines) { + if (!this.db.get_product_by_id(orderline[2].product_id)) { + productIds.push(orderline[2].product_id); + } + } + } + await this._addProducts(productIds, false); + } _addPosPricelists(pricelistsJson) { if (!this.config.use_pricelist) { this.config.use_pricelist = true;