From 471943a3dccf65732bd874fda0c6d1a0cea84047 Mon Sep 17 00:00:00 2001 From: ljain112 Date: Wed, 19 Mar 2025 17:20:25 +0530 Subject: [PATCH] refactor: removed redundant message display for each item row cost center update --- erpnext/public/js/utils/sales_common.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/erpnext/public/js/utils/sales_common.js b/erpnext/public/js/utils/sales_common.js index ed01143c63..6a344c467a 100644 --- a/erpnext/public/js/utils/sales_common.js +++ b/erpnext/public/js/utils/sales_common.js @@ -451,22 +451,21 @@ erpnext.sales_common = { args: { project: this.frm.doc.project }, callback: function (r, rt) { if (!r.exc) { - $.each(me.frm.doc["items"] || [], function (i, row) { - if (r.message) { + if (r.message) { + $.each(me.frm.doc["items"] || [], function (i, row) { frappe.model.set_value( row.doctype, row.name, "cost_center", r.message ); - frappe.msgprint( - __( - "Cost Center For Item with Item Code {0} has been Changed to {1}", - [row.item_name, r.message] - ) - ); - } - }); + }); + frappe.msgprint( + __("Cost Center for Item rows has been updated to {0}", [ + r.message, + ]) + ); + } } }, }); -- GitLab