[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) <vlst@odoo.com>
This commit is contained in:
Loukas Wets (lowe)
2023-09-22 15:06:07 +00:00
parent 4fdff785c6
commit 80a0ca239a
@@ -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;