fix: BIG-206 Reconcilate credit note and vendor credit with invoices should amount to credit be max the invoice remaining amount.

This commit is contained in:
a.bouhuolia
2021-12-30 15:39:22 +02:00
parent 0bd11419bb
commit 0173630e80
6 changed files with 105 additions and 13 deletions

View File

@@ -66,3 +66,13 @@ export const useReconcileVendorCreditTableColumns = () => {
[],
);
};
/**
* Sets max amount credit from purchase due amount.
*/
export const maxAmountCreditFromRemaining = (entries) => {
return entries.map((entry) => ({
...entry,
amount: entry.amount ? Math.min(entry.due_amount, entry.amount) : '',
}));
};