Set salary component properties in existing components and salary structures
This commit is contained in:
parent
f184e35a4a
commit
c114ceb67d
@ -38,15 +38,14 @@ class SalaryStructure(Document):
|
|||||||
have_a_flexi = True
|
have_a_flexi = True
|
||||||
max_of_component = frappe.db.get_value("Salary Component", earning_component.salary_component, "max_benefit_amount")
|
max_of_component = frappe.db.get_value("Salary Component", earning_component.salary_component, "max_benefit_amount")
|
||||||
flexi_amount += max_of_component
|
flexi_amount += max_of_component
|
||||||
if have_a_flexi and self.max_benefits == 0:
|
if have_a_flexi and flt(self.max_benefits) == 0:
|
||||||
frappe.throw(_("Max benefits should be greater than zero to dispense benefits"))
|
frappe.throw(_("Max benefits should be greater than zero to dispense benefits"))
|
||||||
if have_a_flexi and self.max_benefits > flexi_amount:
|
if have_a_flexi and flt(self.max_benefits) > flexi_amount:
|
||||||
frappe.throw(_("Total flexible benefit component amount {0} should not be less \
|
frappe.throw(_("Total flexible benefit component amount {0} should not be less \
|
||||||
than max benefits {1}").format(flexi_amount, self.max_benefits))
|
than max benefits {1}").format(flexi_amount, self.max_benefits))
|
||||||
if not have_a_flexi and self.max_benefits > 0:
|
if not have_a_flexi and flt(self.max_benefits) > 0:
|
||||||
frappe.throw(_("Salary Structure should have flexible benefit component(s) to dispense benefit amount"))
|
frappe.throw(_("Salary Structure should have flexible benefit component(s) to dispense benefit amount"))
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_salary_slip(source_name, target_doc = None, employee = None, as_print = False, print_format = None):
|
def make_salary_slip(source_name, target_doc = None, employee = None, as_print = False, print_format = None):
|
||||||
def postprocess(source, target):
|
def postprocess(source, target):
|
||||||
|
|||||||
13
erpnext/patches/v11_0/set_salary_component_properties.py
Normal file
13
erpnext/patches/v11_0/set_salary_component_properties.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.db.sql("update `tabSalary Component` set is_payable=1, is_tax_applicable=1 where type='Earning'")
|
||||||
|
frappe.db.sql("update `tabSalary Component` set is_payable=0 where type='Deduction'")
|
||||||
|
|
||||||
|
frappe.db.sql("""update `tabSalary Component` set variable_based_on_taxable_salary=1
|
||||||
|
where type='Deduction' and name in ('TDS', 'Tax Deducted at Source')""")
|
||||||
|
|
||||||
|
frappe.db.sql("""update `tabSalary Detail` set is_tax_applicable=1
|
||||||
|
where parentfield='earnings' and statistical_component=0""")
|
||||||
|
frappe.db.sql("""update `tabSalary Detail` set variable_based_on_taxable_salary=1
|
||||||
|
where parentfield='deductions' and salary_component in ('TDS', 'Tax Deducted at Source')""")
|
||||||
Loading…
x
Reference in New Issue
Block a user