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)

(cherry picked from commit a53a9a7)

# Conflicts:
#	hrms/payroll/doctype/additional_salary/additional_salary.json
  • Loading branch information
asmitahase authored and mergify[bot] committed Nov 19, 2024
1 parent 7f93da5 commit d54e222
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 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);
}
},
});
},
});
6 changes: 4 additions & 2 deletions hrms/payroll/doctype/additional_salary/additional_salary.json
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,11 @@
],
"is_submittable": 1,
"links": [],
<<<<<<< HEAD
"modified": "2023-03-14 10:31:03.071277",
=======
"modified": "2024-11-14 16:51:17.594568",
>>>>>>> a53a9a7a3 (fix(Additional Salary): amount gets overwritten by salary component amount even if mapped from a reference document (#2420))
"modified_by": "Administrator",
"module": "Payroll",
"name": "Additional Salary",
Expand Down

0 comments on commit d54e222

Please sign in to comment.