[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) <jcb@odoo.com>
This commit is contained in:
Bruno Boi
2023-04-06 17:20:57 +02:00
parent 5ad0aa5c2a
commit dd9973d4df
+2 -1
View File
@@ -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;
}
});