From 1e4dbaa8bcc489de79ee834cc7ff116735d00296 Mon Sep 17 00:00:00 2001 From: "Adrien Guilliams (adgu)" Date: Tue, 8 Aug 2023 12:16:07 +0000 Subject: [PATCH] [FIX] pos_restaurant: order reminder with product without category Sometimes, it is possible to have a product for which its category is unknown by the pos db of the config. This can happen for example when using pos_loyalty. If a user makes a "buy x get y" program with the reward being a product with a category not accepted by the config (e.g. due to a restrict category of the config), the category id cannot be found in the db of this pos. This leads to problem in pos_restaurant as under the button order, there is a reminder of the products that should be sent either to the preparation display or the preparation printer linked to this pos. If this preparation display or preparation printer contains the category of the reward, the problem happens. The fix is to not show the new category (as it is at first not available due to the restrict so we comply with the choice of the user). This might be a temporarly fix while waiting for a better solution. closes odoo/odoo#131379 X-original-commit: a82b550dcf4311ee35570f5b9dc37bf50a46c17d Signed-off-by: Joseph Caburnay (jcb) --- .../product_screen/actionpad_widget/actionpad_widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 efa2a55764d..97d4c651877 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 @@ -51,7 +51,7 @@ patch(ActionpadWidget.prototype, { 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) { + if (!categoryId || !this.pos.db.category_by_id[categoryId]) { continue; } const category = this.pos.db.category_by_id[categoryId].name;