fix: move feature into update_billing_hours

This commit is contained in:
Raffael Meyer 2020-06-09 16:09:40 +02:00 committed by GitHub
parent d27d88c3e4
commit 088ab75083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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){