diff --git a/hrms/hr/doctype/job_applicant/job_applicant.py b/hrms/hr/doctype/job_applicant/job_applicant.py index 43b1d495e73..994ec44db3e 100644 --- a/hrms/hr/doctype/job_applicant/job_applicant.py +++ b/hrms/hr/doctype/job_applicant/job_applicant.py @@ -50,9 +50,9 @@ class JobApplicant(Document): # end: auto-generated types def onload(self): - job_offer = frappe.get_all("Job Offer", filters={"job_applicant": self.name}) + job_offer = frappe.get_all("Job Offer", filters={"job_applicant": self.name, "docstatus": ["!=", 2]}) if job_offer: - self.get("__onload").job_offer = job_offer[0].name + self.set_onload("job_offer", job_offer[0].name) employee = frappe.db.get_value("Employee", {"job_applicant": self.name}, "name") or "" self.set_onload("employee", employee) diff --git a/hrms/hr/doctype/job_applicant/test_job_applicant.py b/hrms/hr/doctype/job_applicant/test_job_applicant.py index 65fb4404d51..496c84b395e 100644 --- a/hrms/hr/doctype/job_applicant/test_job_applicant.py +++ b/hrms/hr/doctype/job_applicant/test_job_applicant.py @@ -14,6 +14,24 @@ class TestJobApplicant(HRMSTestSuite): + def test_onload_filters_out_cancelled_job_offer(self): + applicant = create_job_applicant() + job_offer = create_job_offer(job_applicant=applicant.name) + job_offer.submit() + job_offer.cancel() + + applicant.onload() + onload = applicant.get("__onload") or {} + self.assertNotIn("job_offer", onload) + + # positive case: active job offer should be loaded + active_job_offer = create_job_offer(job_applicant=applicant.name) + active_job_offer.submit() + + applicant.onload() + onload = applicant.get("__onload") or {} + self.assertEqual(onload.get("job_offer"), active_job_offer.name) + def test_job_applicant_naming(self): applicant = frappe.get_doc( { diff --git a/hrms/hr/print_format/job_offer/job_offer.json b/hrms/hr/print_format/job_offer/job_offer.json index 0a922306b46..42e2d018c98 100644 --- a/hrms/hr/print_format/job_offer/job_offer.json +++ b/hrms/hr/print_format/job_offer/job_offer.json @@ -9,12 +9,13 @@ "html": "{% set terms_exist = doc.terms and (doc.terms|striptags).strip() or \"\" %}\n\n{% if letter_head and not no_letterhead -%}\n
{{ letter_head }}
\n
\n{%- endif %}\n\n
\n

\n\n\nDate: {{ doc.offer_date }}\n

\n\nDear {{ doc.applicant_name }}, \n\n

\n\nWe are pleased to appoint you in the services of {{ doc.company }} on the terms and conditions detailed in this letter.\n\n

\n\nYour designation shall be {{ doc.designation }}.\n\n

\n\n\n\n{%- if doc.offer_terms -%}\n {%- for row in doc.offer_terms -%}\n {{ row.offer_term }}: {{ row.value }}\n\n
\n {%- endfor -%}\n{%- endif -%}\n\n
\n\n\n\n\nPlease read the detailed terms as below. If you have any queries, feel free to get in touch with us.\nWe look forward to your long and fruitful career association with our organisation.\nIf you decide to join us, 'Welcome to {{ doc.company }} !'\n\n

\n\n

\n\nYours truly,\n\n



\n\nAuthorized Signatory\n\n
\n\n{{ doc.company }}\n\n\n\n

\n
\n\n\n{% if terms_exist %}\n
{{ doc.terms }}
\n{% endif %}", "idx": 0, "line_breaks": 0, - "modified": "2018-02-15 03:03:55.844085", + "modified": "2026-08-13 23:59:20.941649", "modified_by": "Administrator", "module": "HR", "name": "Job Offer", "owner": "Administrator", "print_format_builder": 0, + "print_format_for": "DocType", "print_format_type": "Jinja", "show_section_headings": 0, "standard": "Yes" diff --git a/hrms/hr/print_format/standard_appointment_letter/standard_appointment_letter.json b/hrms/hr/print_format/standard_appointment_letter/standard_appointment_letter.json index 1813e711f56..1837f9a1582 100644 --- a/hrms/hr/print_format/standard_appointment_letter/standard_appointment_letter.json +++ b/hrms/hr/print_format/standard_appointment_letter/standard_appointment_letter.json @@ -10,12 +10,13 @@ "font": "Default", "idx": 0, "line_breaks": 0, - "modified": "2020-01-21 17:24:16.705082", + "modified": "2026-08-13 23:59:20.941649", "modified_by": "Administrator", "module": "HR", "name": "Standard Appointment Letter", "owner": "Administrator", "print_format_builder": 0, + "print_format_for": "DocType", "print_format_type": "Jinja", "raw_printing": 0, "show_section_headings": 0, diff --git a/hrms/hr/report/appraisal_overview/appraisal_overview.js b/hrms/hr/report/appraisal_overview/appraisal_overview.js index 61cbd33911c..ff20aec0369 100644 --- a/hrms/hr/report/appraisal_overview/appraisal_overview.js +++ b/hrms/hr/report/appraisal_overview/appraisal_overview.js @@ -11,6 +11,10 @@ frappe.query_reports["Appraisal Overview"] = { options: "Company", reqd: 1, default: frappe.defaults.get_user_default("Company"), + on_change: (report) => { + frappe.query_report.set_filter_value("employee", ""); + report.refresh(); + }, }, { fieldname: "appraisal_cycle", @@ -23,6 +27,13 @@ frappe.query_reports["Appraisal Overview"] = { fieldtype: "Link", label: __("Employee"), options: "Employee", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "department", diff --git a/hrms/hr/report/employee_advance_summary/employee_advance_summary.js b/hrms/hr/report/employee_advance_summary/employee_advance_summary.js index 739e94d603f..609ef69c37f 100644 --- a/hrms/hr/report/employee_advance_summary/employee_advance_summary.js +++ b/hrms/hr/report/employee_advance_summary/employee_advance_summary.js @@ -10,6 +10,13 @@ frappe.query_reports["Employee Advance Summary"] = { fieldtype: "Link", options: "Employee", width: "80", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "from_date", @@ -31,6 +38,10 @@ frappe.query_reports["Employee Advance Summary"] = { options: "Company", default: frappe.defaults.get_user_default("Company"), reqd: 1, + on_change: (report) => { + frappe.query_report.set_filter_value("employee", ""); + report.refresh(); + }, }, { fieldname: "status", diff --git a/hrms/hr/report/employee_exits/employee_exits.js b/hrms/hr/report/employee_exits/employee_exits.js index a85be5a0dea..e60e415b025 100644 --- a/hrms/hr/report/employee_exits/employee_exits.js +++ b/hrms/hr/report/employee_exits/employee_exits.js @@ -21,6 +21,13 @@ frappe.query_reports["Employee Exits"] = { label: __("Company"), fieldtype: "Link", options: "Company", + on_change: (report) => { + frappe.query_report.set_filter_value({ + employee: "", + reports_to: "", + }); + report.refresh(); + }, }, { fieldname: "department", @@ -39,12 +46,26 @@ frappe.query_reports["Employee Exits"] = { label: __("Employee"), fieldtype: "Link", options: "Employee", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "reports_to", label: __("Reports To"), fieldtype: "Link", options: "Employee", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "interview_status", diff --git a/hrms/hr/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.js b/hrms/hr/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.js index 9b45702f498..8326ba7403e 100644 --- a/hrms/hr/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.js +++ b/hrms/hr/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.js @@ -11,6 +11,10 @@ frappe.query_reports["Employee Hours Utilization Based On Timesheet"] = { options: "Company", default: frappe.defaults.get_user_default("Company"), reqd: 1, + on_change: (report) => { + frappe.query_report.set_filter_value("employee", ""); + report.refresh(); + }, }, { fieldname: "from_date", @@ -31,6 +35,13 @@ frappe.query_reports["Employee Hours Utilization Based On Timesheet"] = { label: __("Employee"), fieldtype: "Link", options: "Employee", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "department", diff --git a/hrms/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.js b/hrms/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.js index 368ff55cded..9d39a6dba91 100644 --- a/hrms/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.js +++ b/hrms/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.js @@ -18,12 +18,23 @@ frappe.query_reports["Employee Leave Balance Summary"] = { options: "Company", reqd: 1, default: frappe.defaults.get_user_default("Company"), + on_change: (report) => { + frappe.query_report.set_filter_value("employee", ""); + report.refresh(); + }, }, { fieldname: "employee", label: __("Employee"), fieldtype: "Link", options: "Employee", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "department", diff --git a/hrms/hr/report/leave_ledger/leave_ledger.js b/hrms/hr/report/leave_ledger/leave_ledger.js index 5e81aa187a2..7ce8b71261a 100644 --- a/hrms/hr/report/leave_ledger/leave_ledger.js +++ b/hrms/hr/report/leave_ledger/leave_ledger.js @@ -28,6 +28,13 @@ frappe.query_reports["Leave Ledger"] = { label: __("Employee"), fieldtype: "Link", options: "Employee", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "status", @@ -48,6 +55,10 @@ frappe.query_reports["Leave Ledger"] = { fieldtype: "Link", options: "Company", default: frappe.defaults.get_user_default("Company"), + on_change: (report) => { + frappe.query_report.set_filter_value("employee", ""); + report.refresh(); + }, }, { fieldname: "department", diff --git a/hrms/hr/report/project_profitability/project_profitability.js b/hrms/hr/report/project_profitability/project_profitability.js index a55639fcca4..c26d2c788e8 100644 --- a/hrms/hr/report/project_profitability/project_profitability.js +++ b/hrms/hr/report/project_profitability/project_profitability.js @@ -11,6 +11,10 @@ frappe.query_reports["Project Profitability"] = { options: "Company", default: frappe.defaults.get_user_default("Company"), reqd: 1, + on_change: (report) => { + frappe.query_report.set_filter_value("employee", ""); + report.refresh(); + }, }, { fieldname: "start_date", @@ -37,6 +41,13 @@ frappe.query_reports["Project Profitability"] = { label: __("Employee"), fieldtype: "Link", options: "Employee", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "project", diff --git a/hrms/hr/report/shift_attendance/shift_attendance.js b/hrms/hr/report/shift_attendance/shift_attendance.js index 8a56f8a6ea6..5baaeaa651a 100644 --- a/hrms/hr/report/shift_attendance/shift_attendance.js +++ b/hrms/hr/report/shift_attendance/shift_attendance.js @@ -22,6 +22,13 @@ frappe.query_reports["Shift Attendance"] = { label: __("Employee"), fieldtype: "Link", options: "Employee", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "shift", @@ -42,6 +49,10 @@ frappe.query_reports["Shift Attendance"] = { options: "Company", reqd: 1, default: frappe.defaults.get_user_default("Company"), + on_change: (report) => { + frappe.query_report.set_filter_value("employee", ""); + report.refresh(); + }, }, { fieldname: "late_entry", diff --git a/hrms/payroll/doctype/additional_salary/additional_salary.js b/hrms/payroll/doctype/additional_salary/additional_salary.js index 274f40bfc63..207ea37eadd 100644 --- a/hrms/payroll/doctype/additional_salary/additional_salary.js +++ b/hrms/payroll/doctype/additional_salary/additional_salary.js @@ -83,6 +83,15 @@ frappe.ui.form.on("Additional Salary", { }); }, + is_recurring: function (frm) { + if (frm.doc.is_recurring) { + frm.set_value("payroll_date", null); + } else { + frm.set_value("from_date", null); + frm.set_value("to_date", null); + } + }, + salary_component: function (frm) { if (!frm.doc.ref_doctype) { frm.trigger("get_salary_component_amount"); diff --git a/hrms/payroll/doctype/additional_salary/additional_salary.py b/hrms/payroll/doctype/additional_salary/additional_salary.py index 0190ba1ec39..d9353f6e6b9 100644 --- a/hrms/payroll/doctype/additional_salary/additional_salary.py +++ b/hrms/payroll/doctype/additional_salary/additional_salary.py @@ -41,8 +41,11 @@ class AdditionalSalary(Document): # end: auto-generated types def before_validate(self): - if self.payroll_date and self.is_recurring: + if self.is_recurring: self.payroll_date = None + else: + self.from_date = None + self.to_date = None def on_submit(self): self.update_employee_referral() diff --git a/hrms/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json b/hrms/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json index d5fee6b5b83..e815552e0e9 100644 --- a/hrms/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json +++ b/hrms/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json @@ -8,11 +8,13 @@ "font": "Default", "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"HTML\", \"options\": \"

{{doc.name}}


\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"employee\"}, {\"print_hide\": 0, \"fieldname\": \"employee_name\"}, {\"print_hide\": 0, \"fieldname\": \"department\"}, {\"print_hide\": 0, \"fieldname\": \"designation\"}, {\"print_hide\": 0, \"fieldname\": \"branch\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"start_date\"}, {\"print_hide\": 0, \"fieldname\": \"end_date\"}, {\"print_hide\": 0, \"fieldname\": \"total_working_hours\"}, {\"print_hide\": 0, \"fieldname\": \"hour_rate\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"time_sheet\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"working_hours\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"timesheets\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_payment_days\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"earnings\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"salary_component\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"depends_on_payment_days\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"deductions\"}, {\"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"gross_pay\"}, {\"print_hide\": 0, \"fieldname\": \"total_deduction\"}, {\"print_hide\": 0, \"fieldname\": \"net_pay\"}, {\"print_hide\": 0, \"fieldname\": \"rounded_total\"}, {\"print_hide\": 0, \"fieldname\": \"total_in_words\"}]", "idx": 0, - "modified": "2016-08-21 21:02:59.896033", + "modified": "2026-08-14 01:00:28.515726", "modified_by": "Administrator", + "module": "Payroll", "name": "Salary Slip based on Timesheet", "owner": "Administrator", "print_format_builder": 1, + "print_format_for": "DocType", "print_format_type": "Jinja", "standard": "Yes" } \ No newline at end of file diff --git a/hrms/payroll/print_format/salary_slip_standard/salary_slip_standard.json b/hrms/payroll/print_format/salary_slip_standard/salary_slip_standard.json index 06212b715b4..7969a29c7d8 100644 --- a/hrms/payroll/print_format/salary_slip_standard/salary_slip_standard.json +++ b/hrms/payroll/print_format/salary_slip_standard/salary_slip_standard.json @@ -12,10 +12,11 @@ "line_breaks": 0, "modified": "2026-08-25 12:24:25.294340", "modified_by": "Administrator", - "module": "HR", + "module": "Payroll", "name": "Salary Slip Standard", "owner": "Administrator", "print_format_builder": 1, + "print_format_for": "DocType", "print_format_type": "Jinja", "show_section_headings": 0, "standard": "Yes" diff --git a/hrms/payroll/print_format/salary_slip_with_year_to_date/salary_slip_with_year_to_date.json b/hrms/payroll/print_format/salary_slip_with_year_to_date/salary_slip_with_year_to_date.json index c125f6cc3dc..b5f98deadfe 100644 --- a/hrms/payroll/print_format/salary_slip_with_year_to_date/salary_slip_with_year_to_date.json +++ b/hrms/payroll/print_format/salary_slip_with_year_to_date/salary_slip_with_year_to_date.json @@ -18,6 +18,7 @@ "name": "Salary Slip with Year to Date", "owner": "Administrator", "print_format_builder": 0, + "print_format_for": "DocType", "print_format_type": "Jinja", "raw_printing": 0, "show_section_headings": 0, diff --git a/hrms/payroll/report/income_tax_computation/income_tax_computation.js b/hrms/payroll/report/income_tax_computation/income_tax_computation.js index 929abd51674..6fbc780d46c 100644 --- a/hrms/payroll/report/income_tax_computation/income_tax_computation.js +++ b/hrms/payroll/report/income_tax_computation/income_tax_computation.js @@ -12,6 +12,10 @@ frappe.query_reports["Income Tax Computation"] = { default: frappe.defaults.get_user_default("Company"), width: "90px", reqd: 1, + on_change: (report) => { + frappe.query_report.set_filter_value("employee", ""); + report.refresh(); + }, }, { fieldname: "payroll_period", @@ -27,6 +31,13 @@ frappe.query_reports["Income Tax Computation"] = { fieldtype: "Link", options: "Employee", width: "90px", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "department", diff --git a/hrms/payroll/report/salary_register/salary_register.js b/hrms/payroll/report/salary_register/salary_register.js index 26fc78fa4f2..4458c91026f 100644 --- a/hrms/payroll/report/salary_register/salary_register.js +++ b/hrms/payroll/report/salary_register/salary_register.js @@ -33,6 +33,13 @@ frappe.query_reports["Salary Register"] = { fieldtype: "Link", options: "Employee", width: "100px", + get_query: () => { + return { + filters: { + company: frappe.query_report.get_filter_value("company"), + }, + }; + }, }, { fieldname: "company", @@ -42,6 +49,10 @@ frappe.query_reports["Salary Register"] = { default: frappe.defaults.get_user_default("Company"), width: "100px", reqd: 1, + on_change: (report) => { + frappe.query_report.set_filter_value("employee", ""); + report.refresh(); + }, }, { fieldname: "docstatus",