diff --git a/erpnext/public/js/utils/sales_common.js b/erpnext/public/js/utils/sales_common.js index 411ebf13e488f3446220ef7f4c4f2ca89e127021..9d7a29f32715f8f28c78ceb7bb3d7bb8f7d5d47f 100644 --- a/erpnext/public/js/utils/sales_common.js +++ b/erpnext/public/js/utils/sales_common.js @@ -410,16 +410,25 @@ erpnext.sales_common = { if (["Delivery Note", "Sales Invoice", "Sales Order"].includes(this.frm.doc.doctype)) { if (this.frm.doc.project) { frappe.call({ - method:'erpnext.projects.doctype.project.project.get_cost_center_name' , - args: {project: this.frm.doc.project}, - callback: function(r, rt) { - if(!r.exc) { - $.each(me.frm.doc["items"] || [], function(i, row) { - if(r.message) { - 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])); - } - }) + method: "erpnext.projects.doctype.project.project.get_cost_center_name", + args: { project: this.frm.doc.project }, + callback: function (r, rt) { + if (!r.exc) { + 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 rows has been updated to {0}", [ + r.message, + ]) + ); + } } } })