correjido unidades y kgs
This commit is contained in:
@@ -746,7 +746,8 @@ function createPendingItemFromSearch({ query, quantity, unit, candidates }) {
|
|||||||
(best?._score >= 0.9 && (!second || best._score - (second?._score || 0) >= 0.2));
|
(best?._score >= 0.9 && (!second || best._score - (second?._score || 0) >= 0.2));
|
||||||
|
|
||||||
if (isStrong) {
|
if (isStrong) {
|
||||||
const displayUnit = inferDefaultUnit({ name: best.name, categories: best.categories });
|
// Usar sell_unit del producto si está configurado, sino inferir por heurística
|
||||||
|
const displayUnit = normalizeUnit(best.sell_unit) || inferDefaultUnit({ name: best.name, categories: best.categories });
|
||||||
const hasQty = quantity != null && Number.isFinite(Number(quantity)) && Number(quantity) > 0;
|
const hasQty = quantity != null && Number.isFinite(Number(quantity)) && Number(quantity) > 0;
|
||||||
const sellsByWeight = displayUnit !== "unit";
|
const sellsByWeight = displayUnit !== "unit";
|
||||||
const hasExplicitUnit = unit != null && unit !== "";
|
const hasExplicitUnit = unit != null && unit !== "";
|
||||||
@@ -773,7 +774,8 @@ function createPendingItemFromSearch({ query, quantity, unit, candidates }) {
|
|||||||
woo_id: c.woo_product_id,
|
woo_id: c.woo_product_id,
|
||||||
name: c.name,
|
name: c.name,
|
||||||
price: c.price,
|
price: c.price,
|
||||||
display_unit: inferDefaultUnit({ name: c.name, categories: c.categories }),
|
sell_unit: c.sell_unit || null,
|
||||||
|
display_unit: normalizeUnit(c.sell_unit) || inferDefaultUnit({ name: c.name, categories: c.categories }),
|
||||||
})),
|
})),
|
||||||
status: PendingStatus.NEEDS_TYPE,
|
status: PendingStatus.NEEDS_TYPE,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ function snapshotRowToItem(row) {
|
|||||||
sale_price: row?.price_sale ?? null,
|
sale_price: row?.price_sale ?? null,
|
||||||
price_html: null,
|
price_html: null,
|
||||||
},
|
},
|
||||||
|
sell_unit: raw?._sell_unit_override || null,
|
||||||
source: "snapshot",
|
source: "snapshot",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user