diff --git a/erpnext/hr/doctype/payroll_entry/payroll_entry.py b/erpnext/hr/doctype/payroll_entry/payroll_entry.py index 4d008fc8296..7104c5f1eef 100644 --- a/erpnext/hr/doctype/payroll_entry/payroll_entry.py +++ b/erpnext/hr/doctype/payroll_entry/payroll_entry.py @@ -33,7 +33,7 @@ class PayrollEntry(Document): if self.payroll_frequency: condition = """and payroll_frequency = '%(payroll_frequency)s'"""% {"payroll_frequency": self.payroll_frequency} - sal_struct = frappe.db.sql(""" + sal_struct = frappe.db.sql_list(""" select name from `tabSalary Structure` where @@ -54,7 +54,8 @@ class PayrollEntry(Document): where t1.name = t2.employee and t2.docstatus = 1 - %s order by t2.from_date desc"""% cond, {"sal_struct": sal_struct, "from_date": self.start_date}, as_dict=True) + %s order by t2.from_date desc + """ % cond, {"sal_struct": tuple(sal_struct), "from_date": self.start_date}, as_dict=True) return emp_list def fill_employee_details(self): diff --git a/erpnext/patches/v11_0/create_salary_structure_assignments.py b/erpnext/patches/v11_0/create_salary_structure_assignments.py index b5ee6c6a291..712269ae6de 100644 --- a/erpnext/patches/v11_0/create_salary_structure_assignments.py +++ b/erpnext/patches/v11_0/create_salary_structure_assignments.py @@ -8,9 +8,15 @@ from erpnext.hr.doctype.salary_structure_assignment.salary_structure_assignment def execute(): frappe.reload_doc("hr", "doctype", "salary_structure_assignment") + frappe.db.sql(""" + delete from `tabSalary Structure Assignment` + where salary_structure in (select name from `tabSalary Structure` where is_active='No' or docstatus!=1) + """) for d in frappe.db.sql(""" - select sse.*, ss.company from `tabSalary Structure Employee` sse, `tabSalary Structure` ss - where ss.name = sse.parent AND sse.employee in (select name from `tabEmployee` where ifNull(status, '') != 'Left')""", as_dict=1): + select sse.*, ss.company + from `tabSalary Structure Employee` sse, `tabSalary Structure` ss + where ss.name = sse.parent AND ss.is_active='Yes' + AND sse.employee in (select name from `tabEmployee` where ifNull(status, '') != 'Left')""", as_dict=1): try: s = frappe.new_doc("Salary Structure Assignment") s.employee = d.employee diff --git a/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py b/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py index 4fd677a7373..390f42740bd 100644 --- a/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py +++ b/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py @@ -11,10 +11,12 @@ def execute(): [ default_warehouse, buying_cost_center, expense_account, selling_cost_center, income_account ] ''' + if not frappe.db.has_column('Item', 'default_warehouse'): + return frappe.reload_doc('stock', 'doctype', 'item_default') frappe.reload_doc('stock', 'doctype', 'item') - + companies = frappe.get_all("Company") if len(companies) == 1: frappe.db.sql('''