From ced656be06f2fc33be176f36e5af4183a2974509 Mon Sep 17 00:00:00 2001 From: "Pedram (PEBR)" Date: Mon, 11 Sep 2023 10:31:03 +0000 Subject: [PATCH] [FIX] point_of_sale: fix weighing scale Before this commit, the weighing scale was not working properly. This was caused by commit 60f41b1f831248c58f554dbe40114ef0d4ce42c0, which modified the getAddProductOptions function to return both the quantity and weight, instead of just the quantity. The "weight" value returned was not handled in the subsequent "add_product" call stack, causing the weighing functionality to fail. This commit fixes the issue by using the quantity value instead of weight in the relevant code paths. In the point of sale context, quantity and weight are interchangeable depending on the use case. This commit fixes the associated tests to check the weight of added order line. Related to PR https://github.com/odoo/enterprise/pull/47211 opw-3487707 closes odoo/odoo#135432 X-original-commit: ab88f96de580250d1e8cad7e49833c51bd6749e7 Related: odoo/enterprise#47379 Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Pedram Bi Ria (pebr) --- addons/point_of_sale/static/src/app/store/models.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/app/store/models.js b/addons/point_of_sale/static/src/app/store/models.js index 748c689a5b8..2a74127fc5f 100644 --- a/addons/point_of_sale/static/src/app/store/models.js +++ b/addons/point_of_sale/static/src/app/store/models.js @@ -138,7 +138,7 @@ export class Product extends PosModel { } async getAddProductOptions(code) { let price_extra = 0.0; - let draftPackLotLines, weight, description, packLotLinesToEdit, attribute_value_ids; + let draftPackLotLines, description, packLotLinesToEdit, attribute_value_ids; let quantity = 1; let comboLines = []; @@ -246,7 +246,7 @@ export class Product extends PosModel { } ); if (confirmed) { - weight = payload.weight; + quantity = payload.weight; } else { // do not add the product; return; @@ -259,7 +259,6 @@ export class Product extends PosModel { return { draftPackLotLines, quantity, - weight, description, price_extra, comboLines,