2020-06-19 19:17:57 +05:30
|
|
|
# Copyright (c) 2019, Frappe and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
|
|
|
|
import frappe
|
2021-12-05 12:44:20 +05:30
|
|
|
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
2021-09-02 16:44:59 +05:30
|
|
|
|
2020-06-19 19:17:57 +05:30
|
|
|
import erpnext
|
|
|
|
|
2021-09-02 16:44:59 +05:30
|
|
|
|
2020-06-19 19:17:57 +05:30
|
|
|
def execute():
|
2020-06-22 12:17:29 +05:30
|
|
|
|
2021-04-13 15:46:01 +05:30
|
|
|
doctypes = [
|
|
|
|
"salary_component",
|
|
|
|
"Employee Tax Exemption Declaration",
|
|
|
|
"Employee Tax Exemption Proof Submission",
|
|
|
|
"Employee Tax Exemption Declaration Category",
|
|
|
|
"Employee Tax Exemption Proof Submission Detail",
|
|
|
|
"gratuity_rule",
|
|
|
|
"gratuity_rule_slab",
|
|
|
|
"gratuity_applicable_component",
|
|
|
|
]
|
|
|
|
|
|
|
|
for doctype in doctypes:
|
2021-08-27 16:42:25 +05:30
|
|
|
frappe.reload_doc("Payroll", "doctype", doctype, force=True)
|
2021-04-13 15:46:01 +05:30
|
|
|
|
2021-08-27 16:42:25 +05:30
|
|
|
reports = ["Professional Tax Deductions", "Provident Fund Deductions", "E-Invoice Summary"]
|
2021-04-13 15:46:01 +05:30
|
|
|
for report in reports:
|
|
|
|
frappe.reload_doc("Regional", "Report", report)
|
|
|
|
frappe.reload_doc("Regional", "Report", report)
|
|
|
|
|
|
|
|
if erpnext.get_region() == "India":
|
2021-12-05 12:44:20 +05:30
|
|
|
create_custom_field(
|
|
|
|
"Salary Component",
|
|
|
|
dict(
|
|
|
|
fieldname="component_type",
|
|
|
|
label="Component Type",
|
|
|
|
fieldtype="Select",
|
|
|
|
insert_after="description",
|
|
|
|
options="\nProvident Fund\nAdditional Provident Fund\nProvident Fund Loan\nProfessional Tax",
|
|
|
|
depends_on='eval:doc.type == "Deduction"',
|
2022-03-28 18:52:46 +05:30
|
|
|
),
|
2021-12-05 12:44:20 +05:30
|
|
|
)
|
2021-04-13 15:46:01 +05:30
|
|
|
|
|
|
|
if frappe.db.exists("Salary Component", "Income Tax"):
|
|
|
|
frappe.db.set_value("Salary Component", "Income Tax", "is_income_tax_component", 1)
|
|
|
|
if frappe.db.exists("Salary Component", "TDS"):
|
|
|
|
frappe.db.set_value("Salary Component", "TDS", "is_income_tax_component", 1)
|
|
|
|
|
|
|
|
components = frappe.db.sql(
|
|
|
|
"select name from `tabSalary Component` where variable_based_on_taxable_salary = 1", as_dict=1
|
|
|
|
)
|
|
|
|
for component in components:
|
|
|
|
frappe.db.set_value("Salary Component", component.name, "is_income_tax_component", 1)
|
|
|
|
|
|
|
|
if erpnext.get_region() == "India":
|
|
|
|
if frappe.db.exists("Salary Component", "Provident Fund"):
|
|
|
|
frappe.db.set_value("Salary Component", "Provident Fund", "component_type", "Provident Fund")
|
|
|
|
if frappe.db.exists("Salary Component", "Professional Tax"):
|
|
|
|
frappe.db.set_value(
|
|
|
|
"Salary Component", "Professional Tax", "component_type", "Professional Tax"
|
|
|
|
)
|