[fix] patch for the salary structure assignment for old employees
This commit is contained in:
parent
fa57cdd86d
commit
33c1a38dc8
@ -21,7 +21,9 @@ class SalaryStructureAssignment(Document):
|
|||||||
if joining_date and getdate(self.from_date) < joining_date:
|
if joining_date and getdate(self.from_date) < joining_date:
|
||||||
frappe.throw(_("From Date {0} cannot be before employee's joining Date {1}")
|
frappe.throw(_("From Date {0} cannot be before employee's joining Date {1}")
|
||||||
.format(self.from_date, joining_date))
|
.format(self.from_date, joining_date))
|
||||||
if relieving_date and getdate(self.from_date) > relieving_date:
|
|
||||||
|
# flag - old_employee is for migrating the old employees data via patch
|
||||||
|
if relieving_date and getdate(self.from_date) > relieving_date and not self.flags.old_employee:
|
||||||
frappe.throw(_("From Date {0} cannot be after employee's relieving Date {1}")
|
frappe.throw(_("From Date {0} cannot be after employee's relieving Date {1}")
|
||||||
.format(self.from_date, relieving_date))
|
.format(self.from_date, relieving_date))
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ class SalaryStructureAssignment(Document):
|
|||||||
if self.from_date and getdate(self.from_date) > getdate(self.to_date):
|
if self.from_date and getdate(self.from_date) > getdate(self.to_date):
|
||||||
frappe.throw(_("From Date {0} cannot be after To Date {1}")
|
frappe.throw(_("From Date {0} cannot be after To Date {1}")
|
||||||
.format(self.from_date, self.to_date))
|
.format(self.from_date, self.to_date))
|
||||||
if relieving_date and getdate(self.to_date) > relieving_date:
|
if relieving_date and getdate(self.to_date) > relieving_date and not self.flags.old_employee:
|
||||||
frappe.throw(_("To Date {0} cannot be after employee's relieving Date {1}")
|
frappe.throw(_("To Date {0} cannot be after employee's relieving Date {1}")
|
||||||
.format(self.to_date, relieving_date))
|
.format(self.to_date, relieving_date))
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,9 @@ def execute():
|
|||||||
s.base = d.base
|
s.base = d.base
|
||||||
s.variable = d.variable
|
s.variable = d.variable
|
||||||
s.company = d.company
|
s.company = d.company
|
||||||
|
|
||||||
|
# to migrate the data of the old employees
|
||||||
|
s.flags.old_employee = True
|
||||||
s.save()
|
s.save()
|
||||||
|
|
||||||
frappe.db.sql("update `tabSalary Structure` set docstatus=1")
|
frappe.db.sql("update `tabSalary Structure` set docstatus=1")
|
||||||
Loading…
x
Reference in New Issue
Block a user