mirror of
https://github.com/frappe/books.git
synced 2024-11-09 23:30:56 +00:00
fix(ux): disallow negative amount in Payments
This commit is contained in:
parent
4a53e0c344
commit
4340113ac9
@ -104,6 +104,14 @@ export default {
|
||||
required: 1,
|
||||
formula: (doc) => doc.getSum('for', 'amount'),
|
||||
validate(value, doc) {
|
||||
if (value < 0) {
|
||||
throw new frappe.errors.ValidationError(
|
||||
frappe._(
|
||||
`Payment amount cannot be less than zero. Amount has been reset to max viable amount.`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (doc.for.length === 0) return;
|
||||
const amount = doc.getSum('for', 'amount');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user