Skip to content

Commit 7146c03

Browse files
SowmyaArunachalammergify[bot]
authored andcommitted
fix: handle parent level project change
(cherry picked from commit 543b6e5)
1 parent e12564d commit 7146c03

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

erpnext/public/js/utils/sales_common.js

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -489,18 +489,28 @@ erpnext.sales_common = {
489489
}
490490

491491
project(doc, cdt, cdn) {
492-
const item = frappe.get_doc(cdt, cdn);
493-
if (item.project) {
494-
$.each(this.frm.doc["items"] || [], function (i, other_item) {
495-
if (!other_item.project) {
496-
frappe.model.set_value(
497-
other_item.doctype,
498-
other_item.name,
499-
"project",
500-
item.project
501-
);
502-
}
503-
});
492+
if (!cdt || !cdn) {
493+
if (this.frm.doc.project) {
494+
$.each(this.frm.doc["items"] || [], function (i, item) {
495+
if (!item.project) {
496+
frappe.model.set_value(item.doctype, item.name, "project", doc.project);
497+
}
498+
});
499+
}
500+
} else {
501+
const item = frappe.get_doc(cdt, cdn);
502+
if (item.project) {
503+
$.each(this.frm.doc["items"] || [], function (i, other_item) {
504+
if (!other_item.project) {
505+
frappe.model.set_value(
506+
other_item.doctype,
507+
other_item.name,
508+
"project",
509+
item.project
510+
);
511+
}
512+
});
513+
}
504514
}
505515
let me = this;
506516
if (["Delivery Note", "Sales Invoice", "Sales Order"].includes(this.frm.doc.doctype)) {

0 commit comments

Comments
 (0)