diff --git a/erpnext/public/js/utils/sales_common.js b/erpnext/public/js/utils/sales_common.js index ca2bed20c7f..bbb2a88e629 100644 --- a/erpnext/public/js/utils/sales_common.js +++ b/erpnext/public/js/utils/sales_common.js @@ -447,22 +447,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, + ]) + ); + } } }, });