-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add validation when paying excess amount #230
Conversation
…nt for an invoice
…played-while-paying-excess-amount Added validation to give error message when trying to pay excess amount for an invoice
models/doctype/Payment/Payment.js
Outdated
throw new frappe.errors.ValidationError( | ||
`Payment amount ${value} cannot be accepted. Please enter a value between 0 and ${amount}` | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piyushsinghania on checking the change, it doesn't allow me to set a value greater than what is expected:
Screen.Recording.2021-11-01.at.10.55.45.mov
So keeping that in mind I suggest a few changes:
- Reword the message to something like "Payment amount cannot exceed ₹ ${amount}." , or you can reword it to also account for the fact that the value has been reset to the max viable amount (in haste they may not notice this, and later on it can be an issue).
- And "Payment amount cannot be ₹ 0.00" in case the amount is 0.
- Don't forget the currency sigil. For this, we could use a helper function to format currencies to the correct precision with the correct sigil.
- Don't forget to wrap the message in
frappe._
to support translations later when we add them.
Other than that it works perfectly, I think capping it to the max viable amount is a nice touch!
(cc: @ankitsinghaniyaz)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1 we'll verify and 100% on the other points.
…played-while-paying-excess-amount Added translation support and currency symbol in the error message
@18alantom addressed all the feedback |
Didn't realize the capping was auto 😅 |
No description provided.