fix: Run income-tax-slab patch only if slab already exists in payroll period (#21684)

This commit is contained in:
Nabin Hait 2020-05-11 19:23:18 +05:30 committed by GitHub
parent e684727923
commit 85a89812a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ import frappe
from frappe.model.utils.rename_field import rename_field
def execute():
if not frappe.db.table_exists("Payroll Period"):
if not (frappe.db.table_exists("Payroll Period") and frappe.db.table_exists("Taxable Salary Slab")):
return
for doctype in ("income_tax_slab", "salary_structure_assignment", "employee_other_income", "income_tax_slab_other_charges"):
@ -60,6 +60,9 @@ def execute():
""", (income_tax_slab.name, company.name, period.start_date))
# move other incomes to separate document
if not frappe.db.table_exists("Employee Tax Exemption Proof Submission"):
return
migrated = []
proofs = frappe.get_all("Employee Tax Exemption Proof Submission",
filters = {'docstatus': 1},
@ -79,6 +82,9 @@ def execute():
except:
pass
if not frappe.db.table_exists("Employee Tax Exemption Declaration"):
return
declerations = frappe.get_all("Employee Tax Exemption Declaration",
filters = {'docstatus': 1},
fields =['payroll_period', 'employee', 'company', 'income_from_other_sources']