Skip to content

Commit

Permalink
fix: don't reset rates in Timesheet Detail when Activity Type is clea…
Browse files Browse the repository at this point in the history
…red (#28056)

* fix: don't reset rates when activity type is cleared

* refactor: suggestions from review

Co-authored-by: Sagar Vora <sagar@resilient.tech>

* refactor: suggestions from review (fix)

* style: fix sider

* fix: sider issue

Co-authored-by: Sagar Vora <sagar@resilient.tech>
  • Loading branch information
barredterra and sagarvora authored Oct 21, 2021
1 parent 2849297 commit 2bdaf7b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions erpnext/projects/doctype/timesheet/timesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,20 @@ frappe.ui.form.on("Timesheet Detail", {
calculate_time_and_amount(frm);
},

activity_type: function(frm, cdt, cdn) {
activity_type: function (frm, cdt, cdn) {
if (!frappe.get_doc(cdt, cdn).activity_type) return;

frappe.call({
method: "erpnext.projects.doctype.timesheet.timesheet.get_activity_cost",
args: {
employee: frm.doc.employee,
activity_type: frm.selected_doc.activity_type,
currency: frm.doc.currency
},
callback: function(r){
if(r.message){
frappe.model.set_value(cdt, cdn, 'billing_rate', r.message['billing_rate']);
frappe.model.set_value(cdt, cdn, 'costing_rate', r.message['costing_rate']);
callback: function (r) {
if (r.message) {
frappe.model.set_value(cdt, cdn, "billing_rate", r.message["billing_rate"]);
frappe.model.set_value(cdt, cdn, "costing_rate", r.message["costing_rate"]);
calculate_billing_costing_amount(frm, cdt, cdn);
}
}
Expand Down

0 comments on commit 2bdaf7b

Please sign in to comment.