From 84ca0ada1b2b11ef2ed2a1ecec937a4101fe55c4 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 01:59:13 +0530 Subject: [PATCH] refactor: using function to unset grand total to default mode of payment in pos (backport #46228) (#46229) refactor: using function to unset grand total to default mode of payment in pos (#46228) (cherry picked from commit 62c3915ecb309569a09344282398ea3f81ede7a1) Co-authored-by: Diptanil Saha --- .../selling/page/point_of_sale/pos_payment.js | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/pos_payment.js b/erpnext/selling/page/point_of_sale/pos_payment.js index fc8b75031c8..b47c25e20bb 100644 --- a/erpnext/selling/page/point_of_sale/pos_payment.js +++ b/erpnext/selling/page/point_of_sale/pos_payment.js @@ -340,19 +340,11 @@ erpnext.PointOfSale.Payment = class { // pass } - async render_payment_section() { + render_payment_section() { this.render_payment_mode_dom(); this.make_invoice_fields_control(); this.update_totals_section(); - let r = await frappe.db.get_value( - "POS Profile", - this.frm.doc.pos_profile, - "disable_grand_total_to_default_mop" - ); - - if (!r.message.disable_grand_total_to_default_mop) { - this.focus_on_default_mop(); - } + this.unset_grand_total_to_default_mop(); } after_render() { @@ -637,6 +629,19 @@ erpnext.PointOfSale.Payment = class { .toLowerCase(); } + async unset_grand_total_to_default_mop() { + const doc = this.events.get_frm().doc; + let r = await frappe.db.get_value( + "POS Profile", + doc.pos_profile, + "disable_grand_total_to_default_mop" + ); + + if (!r.message.disable_grand_total_to_default_mop) { + this.focus_on_default_mop(); + } + } + validate_reqd_invoice_fields() { const doc = this.events.get_frm().doc; let validation_flag = true;