fixes in employee helper

This commit is contained in:
Anand Doshi 2013-02-18 19:57:16 +05:30
parent ac1985ff68
commit 6ad06f3210

View File

@ -3,6 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes.model.doc import copy_common_fields
def update_employee_details(controller, method=None): def update_employee_details(controller, method=None):
"""update employee details in linked doctypes""" """update employee details in linked doctypes"""
@ -14,14 +15,5 @@ def update_employee_details(controller, method=None):
return return
ss = webnotes.model_wrapper("Salary Structure", active_salary_structure) ss = webnotes.model_wrapper("Salary Structure", active_salary_structure)
ss_doctype = webnotes.get_doctype("Salary Structure") copy_common_fields(controller.doc, ss.doc)
update = False ss.save()
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()