Skip to content

Commit

Permalink
fix(Additional Salary): amount gets overwritten by salary component a…
Browse files Browse the repository at this point in the history
…mount even if mapped from a reference document (#2420)
  • Loading branch information
asmitahase authored Nov 19, 2024
1 parent 2584748 commit a53a9a7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
24 changes: 24 additions & 0 deletions hrms/payroll/doctype/additional_salary/additional_salary.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,28 @@ frappe.ui.form.on("Additional Salary", {
},
});
},

salary_component: function (frm) {
if (!frm.doc.ref_doctype) {
frm.trigger("get_salary_component_amount");
}
},

get_salary_component_amount: function (frm) {
frappe.call({
method: "frappe.client.get_value",
args: {
doctype: "Salary Component",
fieldname: "amount",
filters: {
name: frm.doc.salary_component,
},
},
callback: function (data) {
if (data.message) {
frm.set_value("amount", data.message.amount);
}
},
});
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
"search_index": 1
},
{
"fetch_from": "salary_component.amount",
"fetch_if_empty": 1,
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 1,
Expand Down Expand Up @@ -205,7 +203,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2024-03-27 13:05:58.117102",
"modified": "2024-11-14 16:51:17.594568",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Additional Salary",
Expand Down

0 comments on commit a53a9a7

Please sign in to comment.