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:
parent
74fcbe6dfd
commit
8c46a93b13
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user