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

Updated suggested changes

This commit is contained in:
Piyush Singhania 2021-10-29 23:12:10 +05:30
parent 102ef29d6b
commit 6178cf55c0

View File

@ -105,11 +105,13 @@ module.exports = {
required: 1,
formula: doc => doc.getSum('for', 'amount'),
validate(value, doc) {
let amount = doc.getSum('for', 'amount');
let isValid = amount >= value && value > 0 ? true : false;
const amount = doc.getSum('for', 'amount');
const isValid = amount >= value && value > 0;
if (!isValid) {
throw new frappe.errors.ValidationError(`Invalid amount ${value}`);
throw new frappe.errors.ValidationError(
`Payment amount ${value} cannot be accepted. Please enter a value between 0 and ${amount}`
);
}
}
},