From caeb9dc025258acc7ba2d033977b65d153af598c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 24 Aug 2016 15:14:48 +0530 Subject: [PATCH] [minor] update salary structure company if not set --- .../move_employee_parent_to_child_in_salary_structure.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v7_0/move_employee_parent_to_child_in_salary_structure.py b/erpnext/patches/v7_0/move_employee_parent_to_child_in_salary_structure.py index 509c0a866b..23f2778bb7 100644 --- a/erpnext/patches/v7_0/move_employee_parent_to_child_in_salary_structure.py +++ b/erpnext/patches/v7_0/move_employee_parent_to_child_in_salary_structure.py @@ -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()