Skip to content

Commit

Permalink
fix(pos): cannot change paid amount in pos payments (#30661)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Apr 9, 2022
1 parent d66979f commit e69849d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions erpnext/selling/page/point_of_sale/pos_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit e69849d

Please sign in to comment.