From 5a23d7cdca32431e3563a966acb5eaae8f9b4610 Mon Sep 17 00:00:00 2001 From: Sanket322 Date: Sun, 13 Apr 2025 13:24:33 +0530 Subject: [PATCH] fix: ensure backend response is awaited before saving (cherry picked from commit c48db0b7c0391a6c87d552461756ad69f5866326) --- erpnext/public/js/controllers/taxes_and_totals.js | 2 +- erpnext/public/js/controllers/transaction.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 541fbf1fb8a..c50e6e53928 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -64,7 +64,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { && this.frm.doc.is_pos && this.frm.doc.is_return ) { - this.set_total_amount_to_default_mop(); + await this.set_total_amount_to_default_mop(); this.calculate_paid_amount(); } diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index db4783582ec..0f0d68b3d8b 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -870,8 +870,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length); } - validate() { - this.calculate_taxes_and_totals(false); + async validate() { + await this.calculate_taxes_and_totals(false); } update_stock() {