Update set_salary_details_submitable.py

This commit is contained in:
Nabin Hait 2019-04-22 11:16:47 +05:30
parent 35e52b5596
commit 36561801c2

View File

@ -1,12 +1,11 @@
from __future__ import unicode_literals
import frappe
import itertools
def execute():
salary_structure = frappe.get_all("Salary Structure", filters={"docstatus": 1}, as_list=1)
salary_structure = list(itertools.chain(*salary_structure))
salary_structure = "', '".join(map(str, salary_structure))
query = ''' update `tabSalary Detail` set docstatus=1 where parent in ('{0}')'''.format(salary_structure)
frappe.db.sql(query)
frappe.db.sql("""
update `tabSalary Structure` ss, `tabSalary Detail` sd
set sd.docstatus=1
where ss.name=sd.parent and ss.docstatus=1 and sd.parenttype='Salary Structure'
""")