From 6ad06f3210b6b56edc176e27cb3009eea71c4d7f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 18 Feb 2013 19:57:16 +0530 Subject: [PATCH] fixes in employee helper --- hr/helpers/employee.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/hr/helpers/employee.py b/hr/helpers/employee.py index 545b59540c..9a7eb3f368 100644 --- a/hr/helpers/employee.py +++ b/hr/helpers/employee.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import webnotes +from webnotes.model.doc import copy_common_fields def update_employee_details(controller, method=None): """update employee details in linked doctypes""" @@ -14,14 +15,5 @@ def update_employee_details(controller, method=None): return ss = webnotes.model_wrapper("Salary Structure", active_salary_structure) - ss_doctype = webnotes.get_doctype("Salary Structure") - update = False - for fieldname, value in controller.doc.fields.items(): - if ss_doctype.get_field(fieldname) and ss.doc.fields[fieldname] != value: - ss.doc.fields[fieldname] = value - update = True - - if update: - ss.save() - - \ No newline at end of file + copy_common_fields(controller.doc, ss.doc) + ss.save()