From 80a0ca239ae4cb822e29668b57f51f96ff8cfc08 Mon Sep 17 00:00:00 2001 From: "Loukas Wets (lowe)" Date: Fri, 22 Sep 2023 10:16:18 +0200 Subject: [PATCH] [FIX] point_of_sale: missing product cross order Prior to this commit if an order was sent to another pos with the cross order, if the product was missing in the target pos, the product will be missing in the order. This commit loads the products that are missing for the cross orders. Task-3504316 closes odoo/odoo#136263 Signed-off-by: Vlad Stroia (vlst) --- .../point_of_sale/static/src/app/store/pos_store.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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;