commit
43ffa64849
@ -11,9 +11,12 @@ def get_period_list(fiscal_year, periodicity, from_beginning=False):
|
||||
"""Get a list of dict {"to_date": to_date, "key": key, "label": label}
|
||||
Periodicity can be (Yearly, Quarterly, Monthly)"""
|
||||
|
||||
start_date, end_date = frappe.db.get_value("Fiscal Year", fiscal_year, ["year_start_date", "year_end_date"])
|
||||
start_date = getdate(start_date)
|
||||
end_date = getdate(end_date)
|
||||
fy_start_end_date = frappe.db.get_value("Fiscal Year", fiscal_year, ["year_start_date", "year_end_date"])
|
||||
if not fy_start_end_date:
|
||||
frappe.throw(_("Fiscal Year {0} not found.").format(fiscal_year))
|
||||
|
||||
start_date = getdate(fy_start_end_date[0])
|
||||
end_date = getdate(fy_start_end_date[1])
|
||||
|
||||
if periodicity == "Yearly":
|
||||
period_list = [_dict({"to_date": end_date, "key": fiscal_year, "label": fiscal_year})]
|
||||
|
@ -128,11 +128,8 @@ class SalaryManager(Document):
|
||||
for ss in ss_list:
|
||||
ss_obj = frappe.get_doc("Salary Slip",ss[0])
|
||||
try:
|
||||
frappe.db.set(ss_obj, 'email_check', cint(self.send_email))
|
||||
if cint(self.send_email) == 1:
|
||||
ss_obj.send_mail_funct()
|
||||
|
||||
frappe.db.set(ss_obj, 'docstatus', 1)
|
||||
ss_obj.email_check = self.send_email
|
||||
ss_obj.submit()
|
||||
except Exception,e:
|
||||
not_submitted_ss.append(ss[0])
|
||||
frappe.msgprint(e)
|
||||
|
@ -14,8 +14,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn){
|
||||
if((!doc.__islocal) && (doc.is_active == 'Yes')){
|
||||
cur_frm.add_custom_button(__('Make Salary Slip'), cur_frm.cscript['Make Salary Slip']);
|
||||
}
|
||||
|
||||
cur_frm.toggle_enable('employee', doc.__islocal);
|
||||
}
|
||||
|
||||
cur_frm.cscript['Make Salary Slip'] = function() {
|
||||
|
@ -54,18 +54,27 @@ class SalaryStructure(Document):
|
||||
def check_existing(self):
|
||||
ret = frappe.db.sql("""select name from `tabSalary Structure` where is_active = 'Yes'
|
||||
and employee = %s and name!=%s""", (self.employee,self.name))
|
||||
|
||||
if ret and self.is_active=='Yes':
|
||||
frappe.throw(_("Another Salary Structure {0} is active for employee {0}. Please make its status 'Inactive' to proceed.").format(cstr(ret), self.employee))
|
||||
frappe.throw(_("Another Salary Structure {0} is active for employee {1}. Please make its status 'Inactive' to proceed.").format(cstr(ret[0][0]), self.employee))
|
||||
|
||||
def validate_amount(self):
|
||||
if flt(self.net_pay) < 0:
|
||||
frappe.throw(_("Net pay cannot be negative"))
|
||||
|
||||
def validate_employee(self):
|
||||
old_employee = frappe.db.get_value("Salary Structure", self.name, "employee")
|
||||
if old_employee and self.employee != old_employee:
|
||||
frappe.throw(_("Employee can not be changed"))
|
||||
|
||||
|
||||
def validate(self):
|
||||
self.check_existing()
|
||||
self.validate_amount()
|
||||
self.validate_employee()
|
||||
set_employee_name(self)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_salary_slip(source_name, target_doc=None):
|
||||
def postprocess(source, target):
|
||||
|
Loading…
x
Reference in New Issue
Block a user