mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
3e466c647c
- get form to render - minor ui fixes
35 lines
804 B
TypeScript
35 lines
804 B
TypeScript
import { Doc } from 'fyo/model/doc';
|
|
import { FiltersMap, FormulaMap } from 'fyo/model/types';
|
|
import Money from 'pesa/dist/types/src/money';
|
|
|
|
export class PaymentFor extends Doc {
|
|
formulas: FormulaMap = {
|
|
amount: {
|
|
formula: async () => {
|
|
if (!this.referenceName) {
|
|
return this.fyo.pesa(0);
|
|
}
|
|
|
|
const outstandingAmount = this.parentdoc!.getFrom(
|
|
this.referenceType as string,
|
|
this.referenceName as string,
|
|
'outstandingAmount'
|
|
) as Money;
|
|
|
|
if (outstandingAmount) {
|
|
return outstandingAmount;
|
|
}
|
|
|
|
return this.fyo.pesa(0);
|
|
},
|
|
dependsOn: ['referenceName'],
|
|
},
|
|
};
|
|
|
|
static filters: FiltersMap = {
|
|
referenceName: () => ({
|
|
outstandingAmount: ['>', 0],
|
|
}),
|
|
};
|
|
}
|