fix: sider

This commit is contained in:
Anurag Mishra
2021-06-24 13:22:36 +05:30
parent 73b3121127
commit 5683857f9f
7 changed files with 14 additions and 20 deletions

View File

@@ -106,7 +106,8 @@ def create_attendance_records_for_overtime(employee, overtime_type):
attendance.status = 'Present'
attendance.attendance_date = add_days(today(), -(x))
attendance.overtime_type = overtime_type
attendance.overtime_duration = 2 * 3600 #for convertion to duration
#for convertion to duration
attendance.overtime_duration = 2 * 3600
attendance.save()
attendance.submit()

View File

@@ -6,10 +6,10 @@ def get_data():
'fieldname': 'overtime_type',
'transactions': [
{
'items': ['Attendance', 'Timesheet']
'items': [_('Attendance'), _('Timesheet')]
},
{
'items': ['Overtime Slip']
'items': [_('Overtime Slip')]
}
]
}

View File

@@ -21,8 +21,8 @@ def create_overtime_type(**args):
overtime_type.employee = args.employee
overtime_type.standard_multiplier = 1.25
overtime_type.applicable_for_weekend = args.applicable_for_weekend or 0
overtime_type.applicable_for_public_holiday = args.applicable_for_public_holiday or 0
overtime_type.applicable_for_weekend = args.applicable_for_weekend or 0
overtime_type.applicable_for_public_holiday = args.applicable_for_public_holiday or 0
if args.applicable_for_weekend:
overtime_type.weekend_multiplier = 1.5

View File

@@ -535,8 +535,7 @@ class SalarySlip(TransactionBase):
def get_overtime_slips(self):
return frappe.get_all("Overtime Slip", filters = {
'employee': self.employee,
'posting_date': (">=", self.start_date),
'posting_date': ("<=", self.end_date),
'posting_date': ("between", [self.start_date, self.end_date]),
'salary_slip': '',
'docstatus': 1
}, fields = ["name", "from_date", 'to_date'])
@@ -572,6 +571,7 @@ class SalarySlip(TransactionBase):
if "applicable_amount" not in overtime_types_details[detail.overtime_type].keys():
component_amount = sum([data.default_amount for data in self.earnings if data.salary_component in \
overtime_types_details[detail.overtime_type]["components"] and not data.get('additional_salary', None)])
overtime_types_details[detail.overtime_type]["applicable_daily_amount"] = component_amount/self.total_working_days
standard_working_hours = detail.standard_working_time/3600

View File

@@ -6,7 +6,7 @@ def get_data():
'fieldname': 'salary_slip',
'transactions': [
{
'items': ['Overtime Slip']
'items': [_('Overtime Slip')]
}
]
}

View File

@@ -501,12 +501,9 @@ class TestSalarySlip(unittest.TestCase):
daily_wages = applicable_amount/ salary_slip.total_working_days
hourly_wages = daily_wages/ frappe.db.get_single_value("Hr Settings", "standard_working_hours")
overtime_amount = hourly_wages * 4 * 1.25
#since multiplier is defined as 1.25 and
self.assertEquals(flt(overtime_amount, 2), flt(overtime_component_details.amount, 2) )
#since multiplier is defined as 1.25
# formula = sum(applicable_component)/(working_days)/ daily_standard_working_time * overtime hours * multiplier
self.assertEquals(flt(overtime_amount, 2), flt(overtime_component_details.amount, 2))
def get_salary_component_for_overtime(self):
component = [{
@@ -541,12 +538,8 @@ def make_employee_salary_slip(user, payroll_frequency, salary_structure=None):
salary_structure = payroll_frequency + " Salary Structure Test for Salary Slip"
employee = frappe.db.get_value("Employee",
{
"user_id": user
},
["name", "company", "employee_name"],
as_dict=True)
employee = frappe.db.get_value("Employee", {"user_id": user},
["name", "company", "employee_name"], as_dict=True)
salary_structure_doc = make_salary_structure(salary_structure, payroll_frequency, employee=employee.name, company=employee.company)
salary_slip_name = frappe.db.get_value("Salary Slip", {"employee": frappe.db.get_value("Employee", {"user_id": user})})

View File

@@ -70,7 +70,7 @@ class Timesheet(Document):
if data.is_overtime:
if frappe.db.get_single_value("Payroll Settings", "overtime_based_on") == "Timesheet":
if not self.employee:
frappe.throw("Select Employee, if applicable for overtime")
frappe.throw(_("Select Employee, if applicable for overtime"))
if not data.overtime_type:
frappe.throw(_("Define Overtime Type for Employee {0}").format(self.employee))