[FIX] point_of_sale: Prevent adding archived products by barcode

When limited product loading is enabled, archived products can still be
added to orders by scanning their barcode, because
`get_pos_ui_product_product_by_params` loads archived products to
prevent errors when refunding orders.

This allows adding archived products via barcode even though they are not
visible in the POS interface.

To prevent this, we exclude archived products from the product_by_barcode
when adding products to it. This ensures archived products cannot be
added by barcode when limited product loading is enabled.

opw-3502136

closes odoo/odoo#137119

X-original-commit: 95c3807d541afe0581b636eb8394cd8f79bb770e
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
Pedram (PEBR)
2023-09-29 16:08:48 +00:00
parent cfe0a6f463
commit 020f5061d1
@@ -268,7 +268,7 @@ export class PosDB {
}
}
this.product_by_id[product.id] = product;
if (product.barcode) {
if (product.barcode && product.active) {
this.product_by_barcode[product.barcode] = product;
}
}