From 088ab75083efe44fa9b4a1e6b2a67a79c8ed4c83 Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Tue, 9 Jun 2020 16:09:40 +0200 Subject: [PATCH] fix: move feature into update_billing_hours --- erpnext/projects/doctype/timesheet/timesheet.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js index bd48e55007..defc18bf4e 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.js +++ b/erpnext/projects/doctype/timesheet/timesheet.js @@ -206,9 +206,6 @@ frappe.ui.form.on("Timesheet Detail", { update_billing_hours(frm, cdt, cdn); update_time_rates(frm, cdt, cdn); calculate_billing_costing_amount(frm, cdt, cdn); - - // bill all `hours` by default - frappe.model.set_value(cdt, cdn, "billing_hours", locals[cdt][cdn].hours); }, activity_type: function(frm, cdt, cdn) { @@ -261,7 +258,12 @@ var calculate_end_time = function(frm, cdt, cdn) { var update_billing_hours = function(frm, cdt, cdn){ var child = locals[cdt][cdn]; - if(!child.billable) frappe.model.set_value(cdt, cdn, 'billing_hours', 0.0); + if(!child.billable) { + frappe.model.set_value(cdt, cdn, 'billing_hours', 0.0); + } else { + // bill all hours by default + frappe.model.set_value(cdt, cdn, "billing_hours", child.hours); + } }; var update_time_rates = function(frm, cdt, cdn){