From c33cd5ce15c2f4a50af15d9925264bd4af264a67 Mon Sep 17 00:00:00 2001 From: Krishna Shirsath Date: Mon, 9 Mar 2026 12:50:56 +0530 Subject: [PATCH] refactor(employee): remove anniversary indicator logic from employee form (cherry picked from commit 1f19175fef68074ee5638faa951dcb3f95393186) --- erpnext/setup/doctype/employee/employee.js | 57 ---------------------- 1 file changed, 57 deletions(-) diff --git a/erpnext/setup/doctype/employee/employee.js b/erpnext/setup/doctype/employee/employee.js index ed210f8e4fa..2a525f18f7f 100755 --- a/erpnext/setup/doctype/employee/employee.js +++ b/erpnext/setup/doctype/employee/employee.js @@ -46,8 +46,6 @@ frappe.ui.form.on("Employee", { refresh: function (frm) { frm.fields_dict.date_of_birth.datepicker.update({ maxDate: new Date() }); - frm.trigger("add_anniversary_indicator"); - if (!frm.is_new() && !frm.doc.user_id) { frm.add_custom_button(__("Create User"), () => { const dialog = new frappe.ui.Dialog({ @@ -97,61 +95,6 @@ frappe.ui.form.on("Employee", { } }, - date_of_birth: function (frm) { - frm.trigger("add_anniversary_indicator"); - }, - - date_of_joining: function (frm) { - frm.trigger("add_anniversary_indicator"); - }, - - add_anniversary_indicator: function (frm) { - if (!frm.sidebar || !frm.sidebar.sidebar) return; - - let $sidebar = frm.sidebar.sidebar; - let $indicator_section = $sidebar.find(".anniversary-indicator-section"); - - if (!$indicator_section.length) { - $indicator_section = $(` - - `).insertAfter($sidebar.find(".sidebar-meta-details")); - } - - let content = ""; - let today = moment().startOf("day"); - - if (frm.doc.date_of_birth) { - let dob = moment(frm.doc.date_of_birth); - if (dob.date() === today.date() && dob.month() === today.month()) { - content += `
${__( - "Today is their Birthday!" - )}
`; - } - } - - if (frm.doc.date_of_joining) { - let doj = moment(frm.doc.date_of_joining); - if (doj.date() === today.date() && doj.month() === today.month()) { - let years = today.year() - doj.year(); - if (years > 0) { - content += `
${__( - "Today is their {0} Year Work Anniversary!", - [years] - )}
`; - } - } - } - - if (content) { - $indicator_section.find(".anniversary-content").html(content); - $indicator_section.show(); - } else { - $indicator_section.hide(); - } - }, - prefered_contact_email: function (frm) { frm.events.update_contact(frm); },