fix(pos): cannot change paid amount in pos payments (#30660)

This commit is contained in:
mergify[bot] 2022-04-09 16:28:10 +05:30 committed by GitHub
parent af6b07f9b9
commit 51d77cd85e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -721,11 +721,14 @@ erpnext.PointOfSale.Controller = class {
async save_and_checkout() {
if (this.frm.is_dirty()) {
let save_error = false;
await this.frm.save(null, null, null, () => save_error = true);
// only move to payment section if save is successful
frappe.route_hooks.after_save = () => this.payment.checkout();
return this.frm.save(
null, null, null, () => this.cart.toggle_checkout_btn(true) // show checkout button on error
);
!save_error && this.payment.checkout();
// show checkout button on error
save_error && setTimeout(() => {
this.cart.toggle_checkout_btn(true);
}, 300); // wait for save to finish
} else {
this.payment.checkout();
}