From 89d8a0b6fd09dae416dfe8225b684ec3d09a6d65 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 6 Aug 2019 05:44:13 +0530 Subject: [PATCH] fix: reset_employee_emails_cache method --- erpnext/hr/doctype/employee/employee.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index 67f7443efd..d407945da7 100755 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -217,10 +217,12 @@ class Employee(NestedSet): def reset_employee_emails_cache(self): prev_doc = self.get_doc_before_save() - if (self.cell_number != prev_doc.cell_number or - self.user_id != prev_doc.user_id): - frappe.cache().hdel('employees_with_number', prev_doc.cell_number) - frappe.cache().hdel('employees_with_number', self.cell_number) + cell_number = self.get('cell_number') + prev_number = prev_doc.get('cell_number') + if (cell_number != prev_number or + self.get('user_id') != prev_doc.get('user_id')): + frappe.cache().hdel('employees_with_number', cell_number) + frappe.cache().hdel('employees_with_number', prev_number) def get_timeline_data(doctype, name): '''Return timeline for attendance'''