fix(pos): cannot change paid amount in pos payments (#30660)
diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js
index 6974bed..65e0cbb 100644
--- a/erpnext/selling/page/point_of_sale/pos_controller.js
+++ b/erpnext/selling/page/point_of_sale/pos_controller.js
@@ -721,11 +721,14 @@
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();
}