[FIX] point_of_sale: prevent duplicate display of multi attributes

Prior to this commit, if a product had multiple attributes, each
attribute would be displayed multiple times in the order line. This
commit resolves this issue by ensuring that each attribute line is
displayed only once.

opw-3849701

closes odoo/odoo#162258

Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
This commit is contained in:
Pedram (pebr)
2024-04-18 12:55:04 +00:00
parent 405f3eaa68
commit 9e8c451f69
@@ -1095,8 +1095,12 @@ export class Orderline extends PosModel {
}
findAttribute(values, customAttributes) {
const listOfAttributes = [];
const addedPtal_id = [];
for (const value of values){
for (const ptal_id of this.pos.ptal_ids_by_ptav_id[value]){
if (addedPtal_id.includes(ptal_id)){
continue;
}
const attribute = this.pos.attributes_by_ptal_id[ptal_id]
const attFound = attribute.values.filter((target) => {
return Object.values(values).includes(target.id);
@@ -1115,6 +1119,7 @@ export class Orderline extends PosModel {
valuesForOrderLine: attFound,
};
listOfAttributes.push(modifiedAttribute);
addedPtal_id.push(ptal_id);
}
}
return listOfAttributes;