From c7b741ce046ea8039133eec40aefd75a3ac26262 Mon Sep 17 00:00:00 2001 From: "Adrien Guilliams (adgu)" Date: Thu, 20 Jul 2023 14:00:16 +0000 Subject: [PATCH] [FIX] pos_restaurant: product with no category When computing the category count for the ActionpadWidget, it is possible that a product does not have one. If it doesn't, we do not take it into account in the category count. This implementation also fixes the crash when opening an order with a order change with a product without category. closes odoo/odoo#129960 X-original-commit: 86c69c2f4f91bfc91871ca0c4f6ea5acff3c975c Signed-off-by: Joseph Caburnay (jcb) --- .../product_screen/actionpad_widget/actionpad_widget.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/pos_restaurant/static/src/overrides/components/product_screen/actionpad_widget/actionpad_widget.js b/addons/pos_restaurant/static/src/overrides/components/product_screen/actionpad_widget/actionpad_widget.js index ad21ae7d190..82654a8f8ac 100644 --- a/addons/pos_restaurant/static/src/overrides/components/product_screen/actionpad_widget/actionpad_widget.js +++ b/addons/pos_restaurant/static/src/overrides/components/product_screen/actionpad_widget/actionpad_widget.js @@ -56,6 +56,9 @@ patch(ActionpadWidget.prototype, "point_of_sale.ActionpadWidget", { for (const idx in orderChange) { const orderline = orderChange[idx]; const categoryId = this.pos.db.get_product_by_id(orderline.product_id).pos_categ_ids[0]; + if (!categoryId) { + continue; + } const category = this.pos.db.category_by_id[categoryId].name; const numProd = orderline.quantity; categories[category] = categories[category] ? categories[category] + numProd : numProd;