[fix] On deletion of salary slip decrease the series count (#14508)
This commit is contained in:
parent
3d73a6f7f2
commit
8e74df09a4
@ -14,8 +14,12 @@ from erpnext.utilities.transaction_base import TransactionBase
|
||||
from frappe.utils.background_jobs import enqueue
|
||||
|
||||
class SalarySlip(TransactionBase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SalarySlip, self).__init__(*args, **kwargs)
|
||||
self.series = 'Sal Slip/{0}/.#####'.format(self.employee)
|
||||
|
||||
def autoname(self):
|
||||
self.name = make_autoname('Sal Slip/' +self.employee + '/.#####')
|
||||
self.name = make_autoname(self.series)
|
||||
|
||||
def validate(self):
|
||||
self.status = self.get_status()
|
||||
@ -418,6 +422,10 @@ class SalarySlip(TransactionBase):
|
||||
self.set_status()
|
||||
self.update_status()
|
||||
|
||||
def on_trash(self):
|
||||
from frappe.model.naming import revert_series_if_last
|
||||
revert_series_if_last(self.series, self.name)
|
||||
|
||||
def email_salary_slip(self):
|
||||
receiver = frappe.db.get_value("Employee", self.employee, "prefered_email")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user