* change error message from `create_log` * PEP 8 compliance
This commit is contained in:
parent
47749f4635
commit
ff1b875661
@ -10,6 +10,7 @@ from frappe.utils import cint, flt, nowdate, add_days, getdate, fmt_money, add_t
|
||||
from frappe import _
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
|
||||
|
||||
class PayrollEntry(Document):
|
||||
|
||||
def on_submit(self):
|
||||
@ -23,7 +24,6 @@ class PayrollEntry(Document):
|
||||
cond = self.get_filter_condition()
|
||||
cond += self.get_joining_releiving_condition()
|
||||
|
||||
|
||||
condition = ''
|
||||
if self.payroll_frequency:
|
||||
condition = """and payroll_frequency = '%(payroll_frequency)s'"""% {"payroll_frequency": self.payroll_frequency}
|
||||
@ -355,6 +355,7 @@ class PayrollEntry(Document):
|
||||
self.update(get_start_end_dates(self.payroll_frequency,
|
||||
self.start_date or self.posting_date, self.company))
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_start_end_dates(payroll_frequency, start_date=None, company=None):
|
||||
'''Returns dict of start and end dates for given payroll frequency based on start_date'''
|
||||
@ -387,6 +388,7 @@ def get_start_end_dates(payroll_frequency, start_date=None, company=None):
|
||||
'start_date': start_date, 'end_date': end_date
|
||||
})
|
||||
|
||||
|
||||
def get_frequency_kwargs(frequency_name):
|
||||
frequency_dict = {
|
||||
'monthly': {'months': 1},
|
||||
@ -396,6 +398,7 @@ def get_frequency_kwargs(frequency_name):
|
||||
}
|
||||
return frequency_dict.get(frequency_name)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_end_date(start_date, frequency):
|
||||
start_date = getdate(start_date)
|
||||
@ -410,6 +413,7 @@ def get_end_date(start_date, frequency):
|
||||
else:
|
||||
return dict(end_date='')
|
||||
|
||||
|
||||
def get_month_details(year, month):
|
||||
ysd = frappe.db.get_value("Fiscal Year", year, "year_start_date")
|
||||
if ysd:
|
||||
@ -433,15 +437,21 @@ def get_month_details(year, month):
|
||||
else:
|
||||
frappe.throw(_("Fiscal Year {0} not found").format(year))
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_log(ss_list):
|
||||
if not ss_list or len(ss_list) < 1:
|
||||
frappe.throw(_("No employee for the above selected criteria OR salary slip already created"))
|
||||
if not ss_list:
|
||||
frappe.throw(
|
||||
_("There's no employee for the given criteria. Check that Salary Slips have not already been created."),
|
||||
title='Error'
|
||||
)
|
||||
return ss_list
|
||||
|
||||
|
||||
def format_as_links(salary_slip):
|
||||
return ['<a href="#Form/Salary Slip/{0}">{0}</a>'.format(salary_slip)]
|
||||
|
||||
|
||||
def create_submit_log(submitted_ss, not_submitted_ss, jv_name):
|
||||
|
||||
if not submitted_ss and not not_submitted_ss:
|
||||
|
Loading…
x
Reference in New Issue
Block a user