From aa51e5fea146a570106859a4fd0402a0af133c10 Mon Sep 17 00:00:00 2001 From: Daniel Duque Date: Thu, 26 Dec 2024 12:07:58 +0100 Subject: [PATCH] [FIX] pos_product_multi_barcode: incoherent data If a `barcode` is already in `product_by_barcode`, do not override it, as Odoo does with `product_by_id`. This can lead to incoherent data if something changes after product is first loaded and then reloads (if limited loading is enabled), or it is modified in `product_by_id` and not in `product_by_barcode`. --- pos_product_multi_barcode/static/src/js/db.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pos_product_multi_barcode/static/src/js/db.js b/pos_product_multi_barcode/static/src/js/db.js index 5282421b62..666f6d6173 100644 --- a/pos_product_multi_barcode/static/src/js/db.js +++ b/pos_product_multi_barcode/static/src/js/db.js @@ -20,6 +20,9 @@ odoo.define("pos_product_multi_barcode.db", function (require) { var barcodes = JSON.parse(product.barcodes_json); barcodes.forEach(function (barcode) { + if (barcode in self.product_by_barcode) { + return; + } self.product_by_barcode[barcode] = product; }); });