fix: patches
This commit is contained in:
parent
211b46b7e6
commit
1497e26f82
@ -1,67 +0,0 @@
|
|||||||
import frappe
|
|
||||||
|
|
||||||
|
|
||||||
def execute():
|
|
||||||
if not frappe.db.table_exists("Additional Salary"):
|
|
||||||
return
|
|
||||||
|
|
||||||
for doctype in ("Additional Salary", "Employee Incentive", "Salary Detail"):
|
|
||||||
frappe.reload_doc("Payroll", "doctype", doctype)
|
|
||||||
|
|
||||||
frappe.reload_doc("hr", "doctype", "Leave Encashment")
|
|
||||||
|
|
||||||
if frappe.db.has_column("Leave Encashment", "additional_salary"):
|
|
||||||
leave_encashments = frappe.get_all(
|
|
||||||
"Leave Encashment",
|
|
||||||
fields=["name", "additional_salary"],
|
|
||||||
filters={"additional_salary": ["!=", ""]},
|
|
||||||
)
|
|
||||||
for leave_encashment in leave_encashments:
|
|
||||||
frappe.db.sql(
|
|
||||||
""" UPDATE `tabAdditional Salary`
|
|
||||||
SET ref_doctype = 'Leave Encashment', ref_docname = %s
|
|
||||||
WHERE name = %s
|
|
||||||
""",
|
|
||||||
(leave_encashment["name"], leave_encashment["additional_salary"]),
|
|
||||||
)
|
|
||||||
|
|
||||||
if frappe.db.has_column("Employee Incentive", "additional_salary"):
|
|
||||||
employee_incentives = frappe.get_all(
|
|
||||||
"Employee Incentive",
|
|
||||||
fields=["name", "additional_salary"],
|
|
||||||
filters={"additional_salary": ["!=", ""]},
|
|
||||||
)
|
|
||||||
|
|
||||||
for incentive in employee_incentives:
|
|
||||||
frappe.db.sql(
|
|
||||||
""" UPDATE `tabAdditional Salary`
|
|
||||||
SET ref_doctype = 'Employee Incentive', ref_docname = %s
|
|
||||||
WHERE name = %s
|
|
||||||
""",
|
|
||||||
(incentive["name"], incentive["additional_salary"]),
|
|
||||||
)
|
|
||||||
|
|
||||||
if frappe.db.has_column("Additional Salary", "salary_slip"):
|
|
||||||
additional_salaries = frappe.get_all(
|
|
||||||
"Additional Salary",
|
|
||||||
fields=["name", "salary_slip", "type", "salary_component"],
|
|
||||||
filters={"salary_slip": ["!=", ""]},
|
|
||||||
group_by="salary_slip",
|
|
||||||
)
|
|
||||||
|
|
||||||
salary_slips = [sal["salary_slip"] for sal in additional_salaries]
|
|
||||||
|
|
||||||
for salary in additional_salaries:
|
|
||||||
comp_type = "earnings" if salary["type"] == "Earning" else "deductions"
|
|
||||||
if salary["salary_slip"] and salary_slips.count(salary["salary_slip"]) == 1:
|
|
||||||
frappe.db.sql(
|
|
||||||
"""
|
|
||||||
UPDATE `tabSalary Detail`
|
|
||||||
SET additional_salary = %s
|
|
||||||
WHERE parenttype = 'Salary Slip'
|
|
||||||
and parentfield = %s
|
|
||||||
and parent = %s
|
|
||||||
and salary_component = %s
|
|
||||||
""",
|
|
||||||
(salary["name"], comp_type, salary["salary_slip"], salary["salary_component"]),
|
|
||||||
)
|
|
@ -1,17 +0,0 @@
|
|||||||
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
|
|
||||||
# MIT License. See license.txt
|
|
||||||
|
|
||||||
|
|
||||||
import frappe
|
|
||||||
|
|
||||||
|
|
||||||
def execute():
|
|
||||||
frappe.reload_doc("setup", "doctype", "employee")
|
|
||||||
|
|
||||||
if frappe.db.has_column("Employee", "reason_for_resignation"):
|
|
||||||
frappe.db.sql(
|
|
||||||
""" UPDATE `tabEmployee`
|
|
||||||
SET reason_for_leaving = reason_for_resignation
|
|
||||||
WHERE status = 'Left' and reason_for_leaving is null and reason_for_resignation is not null
|
|
||||||
"""
|
|
||||||
)
|
|
Loading…
x
Reference in New Issue
Block a user