[minor] update salary structure company if not set

This commit is contained in:
Rushabh Mehta 2016-08-24 15:14:48 +05:30
parent 5fb2bc2b87
commit caeb9dc025

View File

@ -5,7 +5,9 @@ def execute():
frappe.reload_doc('hr', 'doctype', 'salary_structure_employee')
for ss in frappe.db.sql(""" select employee, name from `tabSalary Structure`""", as_dict=True):
ss_doc = frappe.get_doc('Salary Structure', ss.name)
se = ss_doc.append('employees',{})
se.employee = ss.employee
se.base = 0
salary_employee = ss_doc.append('employees',{})
salary_employee.employee = ss.employee
salary_employee.base = 0
if not ss_doc.company:
ss_doc.company = frappe.db.get_value('Employee', salary_employee.employee, 'company')
ss_doc.save()