Update employee.py

This commit is contained in:
Nabin Hait 2019-12-03 12:51:27 +05:30 committed by GitHub
parent b4b90eaaf7
commit a0f9db4b83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import getdate, validate_email_address, today, add_years, format_datetime from frappe.utils import getdate, validate_email_address, today, add_years, format_datetime, cstr
from frappe.model.naming import set_name_by_naming_series from frappe.model.naming import set_name_by_naming_series
from frappe import throw, _, scrub from frappe import throw, _, scrub
from frappe.permissions import add_user_permission, remove_user_permission, \ from frappe.permissions import add_user_permission, remove_user_permission, \
@ -218,8 +218,8 @@ class Employee(NestedSet):
def reset_employee_emails_cache(self): def reset_employee_emails_cache(self):
prev_doc = self.get_doc_before_save() or {} prev_doc = self.get_doc_before_save() or {}
cell_number = self.get('cell_number') cell_number = cstr(self.get('cell_number'))
prev_number = prev_doc.get('cell_number') prev_number = cstr(prev_doc.get('cell_number'))
if (cell_number != prev_number or if (cell_number != prev_number or
self.get('user_id') != prev_doc.get('user_id')): self.get('user_id') != prev_doc.get('user_id')):
frappe.cache().hdel('employees_with_number', cell_number) frappe.cache().hdel('employees_with_number', cell_number)