Segunda mejora en el recálculo automático de los importes los items de factura
This commit is contained in:
parent
ff036a7d81
commit
3198a75f73
@ -96,7 +96,14 @@ export function useInvoiceAutoRecalc(
|
|||||||
const prev = itemCache.current.get(idx);
|
const prev = itemCache.current.get(idx);
|
||||||
const next = calculateItemTotals(item, deferredDiscount);
|
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;
|
shouldUpdateHeader = true;
|
||||||
itemCache.current.set(idx, next);
|
itemCache.current.set(idx, next);
|
||||||
setInvoiceItemTotals(form, idx, next);
|
setInvoiceItemTotals(form, idx, next);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user