From 5e5332404d9e18119389c74454640713b4aa6982 Mon Sep 17 00:00:00 2001 From: asmitahase Date: Thu, 21 Nov 2024 18:22:19 +0530 Subject: [PATCH 1/3] fix: removed "fetch from" setting on letter head in salary structure doctype, to make it editable, set the company defualt letter head using form script instead --- hrms/payroll/doctype/salary_structure/salary_structure.js | 4 ++++ hrms/payroll/doctype/salary_structure/salary_structure.json | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hrms/payroll/doctype/salary_structure/salary_structure.js b/hrms/payroll/doctype/salary_structure/salary_structure.js index ddc1c46f28..7943f3b8df 100755 --- a/hrms/payroll/doctype/salary_structure/salary_structure.js +++ b/hrms/payroll/doctype/salary_structure/salary_structure.js @@ -72,6 +72,10 @@ frappe.ui.form.on("Salary Structure", { }, company: function (frm) { + let company = locals[":Company"][frm.doc.company]; + if (!frm.doc.letter_head && company.default_letter_head) { + frm.set_value("letter_head", company.default_letter_head); + } frm.trigger("set_earning_deduction_component"); }, diff --git a/hrms/payroll/doctype/salary_structure/salary_structure.json b/hrms/payroll/doctype/salary_structure/salary_structure.json index 09b0ca8c47..c878844c09 100644 --- a/hrms/payroll/doctype/salary_structure/salary_structure.json +++ b/hrms/payroll/doctype/salary_structure/salary_structure.json @@ -48,7 +48,6 @@ "search_index": 1 }, { - "fetch_from": "company.default_letter_head", "fieldname": "letter_head", "fieldtype": "Link", "label": "Letter Head", @@ -240,7 +239,7 @@ "idx": 1, "is_submittable": 1, "links": [], - "modified": "2024-03-27 13:10:34.984210", + "modified": "2024-11-21 18:02:55.785057", "modified_by": "Administrator", "module": "Payroll", "name": "Salary Structure", From 18dc6fc4ab17d236a85d476c429c031fa2c417c8 Mon Sep 17 00:00:00 2001 From: asmitahase Date: Fri, 22 Nov 2024 11:21:27 +0530 Subject: [PATCH 2/3] fix: added "fetch from company default letter head" back, with "fetch if empty" to make the field editable, intead of using form script to set the value --- .../salary_structure/salary_structure.js | 4 -- .../salary_structure/salary_structure.json | 38 +++---------------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/hrms/payroll/doctype/salary_structure/salary_structure.js b/hrms/payroll/doctype/salary_structure/salary_structure.js index 7943f3b8df..ddc1c46f28 100755 --- a/hrms/payroll/doctype/salary_structure/salary_structure.js +++ b/hrms/payroll/doctype/salary_structure/salary_structure.js @@ -72,10 +72,6 @@ frappe.ui.form.on("Salary Structure", { }, company: function (frm) { - let company = locals[":Company"][frm.doc.company]; - if (!frm.doc.letter_head && company.default_letter_head) { - frm.set_value("letter_head", company.default_letter_head); - } frm.trigger("set_earning_deduction_component"); }, diff --git a/hrms/payroll/doctype/salary_structure/salary_structure.json b/hrms/payroll/doctype/salary_structure/salary_structure.json index c878844c09..4c74939d9d 100644 --- a/hrms/payroll/doctype/salary_structure/salary_structure.json +++ b/hrms/payroll/doctype/salary_structure/salary_structure.json @@ -48,6 +48,9 @@ "search_index": 1 }, { + "allow_on_submit": 1, + "fetch_from": "company.default_letter_head", + "fetch_if_empty": 1, "fieldname": "letter_head", "fieldtype": "Link", "label": "Letter Head", @@ -239,44 +242,13 @@ "idx": 1, "is_submittable": 1, "links": [], - "modified": "2024-11-21 18:02:55.785057", + "modified": "2024-11-22 11:17:28.384386", "modified_by": "Administrator", "module": "Payroll", "name": "Salary Structure", "naming_rule": "Set by user", "owner": "Administrator", - "permissions": [ - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "HR User", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "import": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "HR Manager", - "share": 1, - "submit": 1, - "write": 1 - } - ], + "permissions": [], "show_name_in_global_search": 1, "sort_field": "creation", "sort_order": "DESC", From d3564c4627b4c6a59022d595c8d125397b55ed77 Mon Sep 17 00:00:00 2001 From: asmitahase Date: Fri, 22 Nov 2024 12:26:56 +0530 Subject: [PATCH 3/3] fix: doctype permissions were removed while saving the doctype, couldn't figure out why, added them back --- .../salary_structure/salary_structure.json | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/hrms/payroll/doctype/salary_structure/salary_structure.json b/hrms/payroll/doctype/salary_structure/salary_structure.json index 4c74939d9d..478aeac99a 100644 --- a/hrms/payroll/doctype/salary_structure/salary_structure.json +++ b/hrms/payroll/doctype/salary_structure/salary_structure.json @@ -248,7 +248,38 @@ "name": "Salary Structure", "naming_rule": "Set by user", "owner": "Administrator", - "permissions": [], + "permissions": [ + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR User", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "import": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "share": 1, + "submit": 1, + "write": 1 + } + ], "show_name_in_global_search": 1, "sort_field": "creation", "sort_order": "DESC",