From 35e52b5596d78077a923457b02cb94544767efbe Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Tue, 16 Apr 2019 16:52:55 +0530 Subject: [PATCH 1/2] fix: fixed spelling --- erpnext/patches.txt | 1 + .../patches/v11_1/set_salary_details_submittable.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 erpnext/patches/v11_1/set_salary_details_submittable.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index ccfd37d4da..e0002ab5bd 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -597,3 +597,4 @@ erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019 erpnext.patches.v12_0.move_item_tax_to_item_tax_template erpnext.patches.v11_1.set_variant_based_on erpnext.patches.v11_1.woocommerce_set_creation_user +erpnext.patches.v11_1.set_salary_details_submittable diff --git a/erpnext/patches/v11_1/set_salary_details_submittable.py b/erpnext/patches/v11_1/set_salary_details_submittable.py new file mode 100644 index 0000000000..36e78792ec --- /dev/null +++ b/erpnext/patches/v11_1/set_salary_details_submittable.py @@ -0,0 +1,12 @@ +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) + From 36561801c2279551e9839192901ffa73f98c37ca Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Apr 2019 11:16:47 +0530 Subject: [PATCH 2/2] Update set_salary_details_submitable.py --- .../patches/v11_1/set_salary_details_submittable.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/erpnext/patches/v11_1/set_salary_details_submittable.py b/erpnext/patches/v11_1/set_salary_details_submittable.py index 36e78792ec..f4477d9fd6 100644 --- a/erpnext/patches/v11_1/set_salary_details_submittable.py +++ b/erpnext/patches/v11_1/set_salary_details_submittable.py @@ -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' + """) +