2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 19:09:01 +00:00

fix: paymentType formula for return

This commit is contained in:
akshayitzme 2023-11-18 15:10:44 +05:30
parent 74fcbe6dfd
commit 8c46a93b13

View File

@ -505,13 +505,21 @@ export class Payment extends Transactional {
}
const partyDoc = (await this.loadAndGetLink('party')) as Party;
const outstanding = partyDoc.outstandingAmount as Money;
if (outstanding.isNegative()) {
if (this.referenceType === ModelNameEnum.SalesInvoice) {
return 'Pay';
}
return 'Receive';
}
if (partyDoc.role === 'Supplier') {
return 'Pay';
} else if (partyDoc.role === 'Customer') {
return 'Receive';
}
const outstanding = partyDoc.outstandingAmount as Money;
if (outstanding?.isZero() ?? true) {
return this.paymentType;
}