From 2ffa4b9ce4614273f06bc74aa62e3c85ca304712 Mon Sep 17 00:00:00 2001 From: Ganga Manoj Date: Fri, 8 Jan 2021 20:58:00 +0530 Subject: [PATCH 1/2] fix: Link timesheets with corresponding projects --- erpnext/projects/doctype/timesheet/timesheet.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json index 4c2edf4f03..b28682184e 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.json +++ b/erpnext/projects/doctype/timesheet/timesheet.json @@ -15,7 +15,7 @@ "column_break_3", "salary_slip", "status", - "project", + "parent_project", "employee_detail", "employee", "employee_name", @@ -261,7 +261,7 @@ "read_only": 1 }, { - "fieldname": "project", + "fieldname": "parent_project", "fieldtype": "Link", "label": "Project", "options": "Project" @@ -271,7 +271,7 @@ "idx": 1, "is_submittable": 1, "links": [], - "modified": "2020-10-29 07:50:35.938231", + "modified": "2021-01-08 20:51:14.590080", "modified_by": "Administrator", "module": "Projects", "name": "Timesheet", From 3f015f71428c4d455ddf1859625a0585b8e1406c Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 14 Jan 2021 18:44:14 +0530 Subject: [PATCH 2/2] fix: Update fieldnames --- erpnext/projects/doctype/timesheet/timesheet.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js index b068245a8b..b123af5d18 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.js +++ b/erpnext/projects/doctype/timesheet/timesheet.js @@ -134,7 +134,7 @@ frappe.ui.form.on("Timesheet", { }); }, - project: function(frm) { + parent_project: function(frm) { set_project_in_timelog(frm); }, @@ -168,8 +168,8 @@ frappe.ui.form.on("Timesheet Detail", { }, time_logs_add: function(frm, cdt, cdn) { - if(frm.doc.project) { - frappe.model.set_value(cdt, cdn, 'project', frm.doc.project); + if(frm.doc.parent_project) { + frappe.model.set_value(cdt, cdn, 'project', frm.doc.parent_project); } var $trigger_again = $('.form-grid').find('.grid-row').find('.btn-open-row'); @@ -308,7 +308,9 @@ const set_employee_and_company = function(frm) { }; function set_project_in_timelog(frm) { - if(frm.doc.project){ - erpnext.utils.copy_value_in_all_rows(frm.doc, frm.doc.doctype, frm.doc.name, "time_logs", "project"); + if(frm.doc.parent_project) { + $.each(frm.doc.time_logs || [], function(i, item) { + frappe.model.set_value(item.doctype, item.name, "project", frm.doc.parent_project); + }); } } \ No newline at end of file