From dd9973d4dff3e4af62a08b2c9162b69fd3f73243 Mon Sep 17 00:00:00 2001 From: Bruno Boi Date: Thu, 6 Apr 2023 13:39:29 +0000 Subject: [PATCH] [FIX] point_of_sale: fix traceback with packagings Happen since 29d55e44 To reproduce the error: - Settings > Inventory > Enable "Product Packagings" - Inventory > Configuration > Products > Product Packagings - Create a new packaging having a barcode - Start a Point of Sale session - The session is not loaded and a traceback is raised Reason: we try to apply the find() method on an object instead of an array After this commit, the session is loaded and the packaging is correctly displayed closes odoo/odoo#117947 Signed-off-by: Joseph Caburnay (jcb) --- addons/point_of_sale/static/src/js/db.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/db.js b/addons/point_of_sale/static/src/js/db.js index 43b069bf974..e557c489246 100644 --- a/addons/point_of_sale/static/src/js/db.js +++ b/addons/point_of_sale/static/src/js/db.js @@ -231,7 +231,8 @@ export const PosDB = core.Class.extend({ add_packagings: function (product_packagings) { var self = this; _.map(product_packagings, function (product_packaging) { - if (self.product_by_id.find(({ id }) => id === product_packaging.product_id[0])) { + const products = Object.values(self.product_by_id); + if (products.find(({ id }) => id === product_packaging.product_id[0])) { self.product_packaging_by_barcode[product_packaging.barcode] = product_packaging; } });