fix(payroll-entry): commit submitted salary slip check onchange (#18695)
* fix(payroll-entry): commit submitted salary slip check onchange * fix: track submitted ss via flags
This commit is contained in:
committed by
Nabin Hait
parent
d7ddb0c14e
commit
60b7acc9b0
@@ -69,7 +69,7 @@ frappe.ui.form.on('Payroll Entry', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
add_context_buttons: function(frm) {
|
add_context_buttons: function(frm) {
|
||||||
if(frm.doc.salary_slips_submitted) {
|
if(frm.doc.salary_slips_submitted || (frm.doc.__onload && frm.doc.__onload.submitted_ss)) {
|
||||||
frm.events.add_bank_entry_button(frm);
|
frm.events.add_bank_entry_button(frm);
|
||||||
} else if(frm.doc.salary_slips_created) {
|
} else if(frm.doc.salary_slips_created) {
|
||||||
frm.add_custom_button(__("Submit Salary Slip"), function() {
|
frm.add_custom_button(__("Submit Salary Slip"), function() {
|
||||||
|
|||||||
@@ -13,14 +13,13 @@ from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
|
|||||||
|
|
||||||
class PayrollEntry(Document):
|
class PayrollEntry(Document):
|
||||||
def onload(self):
|
def onload(self):
|
||||||
if not self.docstatus==1:
|
if not self.docstatus==1 or self.salary_slips_submitted:
|
||||||
return
|
return
|
||||||
|
|
||||||
# check if salary slips were manually submitted
|
# check if salary slips were manually submitted
|
||||||
entries = frappe.db.count("Salary Slip", {'payroll_entry': self.name, 'docstatus': 1}, ['name'])
|
entries = frappe.db.count("Salary Slip", {'payroll_entry': self.name, 'docstatus': 1}, ['name'])
|
||||||
if cint(entries) == len(self.employees) and not self.salary_slips_submitted:
|
if cint(entries) == len(self.employees):
|
||||||
self.db_set("salary_slips_submitted", 1)
|
self.set_onload("submitted_ss", True)
|
||||||
self.reload()
|
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.create_salary_slips()
|
self.create_salary_slips()
|
||||||
@@ -423,7 +422,6 @@ def get_start_end_dates(payroll_frequency, start_date=None, company=None):
|
|||||||
'start_date': start_date, 'end_date': end_date
|
'start_date': start_date, 'end_date': end_date
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def get_frequency_kwargs(frequency_name):
|
def get_frequency_kwargs(frequency_name):
|
||||||
frequency_dict = {
|
frequency_dict = {
|
||||||
'monthly': {'months': 1},
|
'monthly': {'months': 1},
|
||||||
|
|||||||
Reference in New Issue
Block a user