blob: 9a7eb3f368316b3552064ef4adba1daf0c9aec4e [file] [log] [blame]
Anand Doshiac1985f2013-02-18 19:42:02 +05301# ERPNext - web based ERP (http://erpnext.com)
2# For license information, please see license.txt
3
4from __future__ import unicode_literals
5import webnotes
Anand Doshi6ad06f32013-02-18 19:57:16 +05306from webnotes.model.doc import copy_common_fields
Anand Doshiac1985f2013-02-18 19:42:02 +05307
8def update_employee_details(controller, method=None):
9 """update employee details in linked doctypes"""
10 if method == "on_update" and controller.doc.doctype == "Employee":
11 # update salary structure
12 active_salary_structure = webnotes.conn.get_value("Salary Structure",
13 {"is_active": "Yes", "employee": controller.doc.name})
14 if not active_salary_structure:
15 return
16
17 ss = webnotes.model_wrapper("Salary Structure", active_salary_structure)
Anand Doshi6ad06f32013-02-18 19:57:16 +053018 copy_common_fields(controller.doc, ss.doc)
19 ss.save()