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));
|
||||
|
||||
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 sellsByWeight = displayUnit !== "unit";
|
||||
const hasExplicitUnit = unit != null && unit !== "";
|
||||
@@ -773,7 +774,8 @@ function createPendingItemFromSearch({ query, quantity, unit, candidates }) {
|
||||
woo_id: c.woo_product_id,
|
||||
name: c.name,
|
||||
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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user