From 3198a75f7318d311f4207524fbbc8eb34f3b4599 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 9 Nov 2025 12:58:17 +0100 Subject: [PATCH] =?UTF-8?q?Segunda=20mejora=20en=20el=20rec=C3=A1lculo=20a?= =?UTF-8?q?utom=C3=A1tico=20de=20los=20importes=20los=20items=20de=20factu?= =?UTF-8?q?ra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/web/hooks/calcs/use-invoice-auto-recalc.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/customer-invoices/src/web/hooks/calcs/use-invoice-auto-recalc.ts b/modules/customer-invoices/src/web/hooks/calcs/use-invoice-auto-recalc.ts index 4405bb45..c1bb8ce9 100644 --- a/modules/customer-invoices/src/web/hooks/calcs/use-invoice-auto-recalc.ts +++ b/modules/customer-invoices/src/web/hooks/calcs/use-invoice-auto-recalc.ts @@ -96,7 +96,14 @@ export function useInvoiceAutoRecalc( const prev = itemCache.current.get(idx); const next = calculateItemTotals(item, deferredDiscount); - if (!prev || JSON.stringify(prev) !== JSON.stringify(next)) { + const itemHasChanges = + !prev || + prev.subtotal_amount !== next.subtotal_amount || + prev.total_amount !== next.total_amount || + prev.taxes_amount !== next.taxes_amount; + + //if (!prev || JSON.stringify(prev) !== JSON.stringify(next)) { <-- Costoso y poco preciso + if (itemHasChanges) { shouldUpdateHeader = true; itemCache.current.set(idx, next); setInvoiceItemTotals(form, idx, next);