(cherry picked from commit 2186c223b9
)
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
parent
295dcd87f9
commit
bfa93ea76f
@ -14,15 +14,21 @@ def execute():
|
|||||||
frappe.reload_doc("hr", "doctype", doctype)
|
frappe.reload_doc("hr", "doctype", doctype)
|
||||||
|
|
||||||
|
|
||||||
|
standard_tax_exemption_amount_exists = frappe.db.has_column("Payroll Period", "standard_tax_exemption_amount")
|
||||||
|
|
||||||
|
select_fields = "name, start_date, end_date"
|
||||||
|
if standard_tax_exemption_amount_exists:
|
||||||
|
select_fields = "name, start_date, end_date, standard_tax_exemption_amount"
|
||||||
|
|
||||||
for company in frappe.get_all("Company"):
|
for company in frappe.get_all("Company"):
|
||||||
payroll_periods = frappe.db.sql("""
|
payroll_periods = frappe.db.sql("""
|
||||||
SELECT
|
SELECT
|
||||||
name, start_date, end_date, standard_tax_exemption_amount
|
{0}
|
||||||
FROM
|
FROM
|
||||||
`tabPayroll Period`
|
`tabPayroll Period`
|
||||||
WHERE company=%s
|
WHERE company=%s
|
||||||
ORDER BY start_date DESC
|
ORDER BY start_date DESC
|
||||||
""", company.name, as_dict = 1)
|
""".format(select_fields), company.name, as_dict = 1)
|
||||||
|
|
||||||
for i, period in enumerate(payroll_periods):
|
for i, period in enumerate(payroll_periods):
|
||||||
income_tax_slab = frappe.new_doc("Income Tax Slab")
|
income_tax_slab = frappe.new_doc("Income Tax Slab")
|
||||||
@ -36,6 +42,7 @@ def execute():
|
|||||||
income_tax_slab.effective_from = period.start_date
|
income_tax_slab.effective_from = period.start_date
|
||||||
income_tax_slab.company = company.name
|
income_tax_slab.company = company.name
|
||||||
income_tax_slab.allow_tax_exemption = 1
|
income_tax_slab.allow_tax_exemption = 1
|
||||||
|
if standard_tax_exemption_amount_exists:
|
||||||
income_tax_slab.standard_tax_exemption_amount = period.standard_tax_exemption_amount
|
income_tax_slab.standard_tax_exemption_amount = period.standard_tax_exemption_amount
|
||||||
|
|
||||||
income_tax_slab.flags.ignore_mandatory = True
|
income_tax_slab.flags.ignore_mandatory = True
|
||||||
|
Loading…
Reference in New Issue
Block a user