added observer for employee doctype to update salary structure
diff --git a/hr/helpers/employee.py b/hr/helpers/employee.py
new file mode 100644
index 0000000..545b595
--- /dev/null
+++ b/hr/helpers/employee.py
@@ -0,0 +1,27 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+def update_employee_details(controller, method=None):
+ """update employee details in linked doctypes"""
+ if method == "on_update" and controller.doc.doctype == "Employee":
+ # update salary structure
+ active_salary_structure = webnotes.conn.get_value("Salary Structure",
+ {"is_active": "Yes", "employee": controller.doc.name})
+ if not active_salary_structure:
+ 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