mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-09 00:01:18 +00:00
fix: Removed print statement
This commit is contained in:
@@ -106,8 +106,6 @@ class Attendance(Document):
|
||||
def calculate_overtime_duration(self):
|
||||
#this method is only for Calculation of overtime based on Attendance through Employee Checkins
|
||||
self.overtime_duration = None
|
||||
print("From calculate_overtime_duration")
|
||||
print(self.working_time, self.standard_working_time, self.shift)
|
||||
|
||||
if not self.standard_working_time and self.shift:
|
||||
self.standard_working_time = frappe.db.get_value("Shift Type", self.shift, "standard_working_time")
|
||||
@@ -164,11 +162,6 @@ def get_overtime_type(employee):
|
||||
"applicable_for": "Employee", "employee": employee}, fields=['name'])
|
||||
if len(overtime_type_doc):
|
||||
overtime_type = overtime_type_doc[0].name
|
||||
|
||||
print("-------------->>> setting Overtime Type")
|
||||
print(employee)
|
||||
print(overtime_type)
|
||||
|
||||
return overtime_type
|
||||
|
||||
@frappe.whitelist()
|
||||
@@ -225,7 +218,6 @@ def mark_attendance(employee, attendance_date, status, shift=None, leave_type=No
|
||||
@frappe.whitelist()
|
||||
def mark_bulk_attendance(data):
|
||||
import json
|
||||
from pprint import pprint
|
||||
if isinstance(data, frappe.string_types):
|
||||
data = json.loads(data)
|
||||
data = frappe._dict(data)
|
||||
|
||||
@@ -112,9 +112,6 @@ def mark_attendance_and_link_log(logs, attendance_status, attendance_date, worki
|
||||
from erpnext.hr.doctype.shift_type.shift_type import convert_time_into_duration
|
||||
working_time = convert_time_into_duration(working_timedelta)
|
||||
|
||||
from pprint import pprint
|
||||
print("------->>>>> mark_attendance_and_link_log")
|
||||
|
||||
doc_dict = {
|
||||
'doctype': 'Attendance',
|
||||
'employee': employee,
|
||||
@@ -128,11 +125,7 @@ def mark_attendance_and_link_log(logs, attendance_status, attendance_date, worki
|
||||
'in_time': in_time,
|
||||
'out_time': out_time
|
||||
}
|
||||
pprint(doc_dict)
|
||||
|
||||
attendance = frappe.get_doc(doc_dict).insert()
|
||||
print("--------------->>>>>>>>>> Allow Overtime")
|
||||
print(frappe.db.get_value("Shift Type", shift, "allow_overtime"))
|
||||
if frappe.db.get_value("Shift Type", shift, "allow_overtime"):
|
||||
attendance.calculate_overtime_duration()
|
||||
attendance.save()
|
||||
|
||||
@@ -59,14 +59,9 @@ class ShiftType(Document):
|
||||
else:
|
||||
checkins_log = itertools.groupby(logs, key=lambda x: (x['employee'], x['shift_actual_start']))
|
||||
|
||||
print("------------>>>Checkins_log")
|
||||
from pprint import pprint
|
||||
|
||||
for key, group in checkins_log:
|
||||
single_shift_logs = list(group)
|
||||
|
||||
pprint(single_shift_logs)
|
||||
|
||||
attendance_status, working_hours, late_entry, early_exit, in_time, out_time = self.get_attendance(single_shift_logs)
|
||||
|
||||
mark_attendance_and_link_log(single_shift_logs, attendance_status, key[1].date(), working_hours, late_entry, early_exit, in_time, out_time, self.name)
|
||||
|
||||
@@ -54,7 +54,6 @@ class OvertimeSlip(Document):
|
||||
if overtime_based_on == "Attendance":
|
||||
records = self.get_attendance_record()
|
||||
if len(records):
|
||||
print("Going to Create")
|
||||
self.create_overtime_details_row_for_attendance(records)
|
||||
elif overtime_based_on == "Timesheet":
|
||||
records = self.get_timesheet_record()
|
||||
@@ -81,7 +80,6 @@ class OvertimeSlip(Document):
|
||||
frappe.throw(_('Please Set "Standard Working Hours" in HR settings'))
|
||||
|
||||
if record.overtime_duration:
|
||||
print("Appending Row")
|
||||
self.append("overtime_details", {
|
||||
"reference_document_type": "Attendance",
|
||||
"reference_document": record.name,
|
||||
@@ -126,16 +124,12 @@ class OvertimeSlip(Document):
|
||||
AND (
|
||||
overtime_duration IS NOT NULL OR overtime_duration != '00:00:00.000000'
|
||||
)
|
||||
""", (getdate(self.from_date), getdate(self.to_date), self.employee), as_dict=1, debug=1)
|
||||
from pprint import pprint
|
||||
print("----->>> Records")
|
||||
pprint(records)
|
||||
""", (getdate(self.from_date), getdate(self.to_date), self.employee), as_dict=1)
|
||||
return records
|
||||
return []
|
||||
|
||||
def get_timesheet_record(self):
|
||||
if self.from_date and self.to_date:
|
||||
|
||||
records = frappe.db.sql("""SELECT ts.name, ts.start_date, ts.end_date, tsd.overtime_on, tsd.overtime_type, tsd.overtime_hours
|
||||
FROM `tabTimesheet` AS ts
|
||||
INNER JOIN `tabTimesheet Detail` As tsd ON tsd.parent = ts.name
|
||||
@@ -158,7 +152,7 @@ def get_standard_working_hours(employee, date):
|
||||
AND start_date < %(date)s
|
||||
and (end_date > %(date)s or end_date is NULL or end_date = "") ''', {
|
||||
"employee": employee, "date": get_datetime(date)}
|
||||
, as_dict=1, debug=1)
|
||||
, as_dict=1)
|
||||
|
||||
standard_working_time = 0
|
||||
|
||||
|
||||
@@ -46,8 +46,6 @@ class TestOvertimeSlip(unittest.TestCase):
|
||||
shift_type.last_sync_of_checkin = get_datetime(add_days(today(), 1))
|
||||
shift_type.save()
|
||||
|
||||
print(shift_type.standard_working_time, shift_type.allow_overtime)
|
||||
|
||||
employee = make_employee("test_employee@overtime.com", company='_Test Company')
|
||||
make_salary_structure("structure for Overtime", "Monthly", employee=employee)
|
||||
|
||||
@@ -56,27 +54,18 @@ class TestOvertimeSlip(unittest.TestCase):
|
||||
checkin = make_checkin(employee, time = get_datetime(today()) + timedelta(hours=9), log_type="IN")
|
||||
checkout = make_checkin(employee, time = get_datetime(today()) + timedelta(hours=20), log_type="OUT")
|
||||
|
||||
print("Checkins Asserted")
|
||||
print(checkin.name)
|
||||
print(checkout.name)
|
||||
self.assertEqual(checkin.shift, shift_type.name)
|
||||
self.assertEqual(checkout.shift, shift_type.name)
|
||||
|
||||
create_overtime_type(employee=employee)
|
||||
shift_type.reload()
|
||||
shift_type.process_auto_attendance()
|
||||
print(employee)
|
||||
|
||||
|
||||
checkin.reload()
|
||||
|
||||
attendance_records = frappe.get_all("Attendance", filters = {
|
||||
'shift': shift_type.name, 'status': 'Present'
|
||||
}, fields = ["name", "overtime_duration", "overtime_type", "attendance_date"])
|
||||
|
||||
from pprint import pprint
|
||||
pprint(attendance_records)
|
||||
|
||||
records = {}
|
||||
for record in attendance_records:
|
||||
records[record.name] = {
|
||||
|
||||
@@ -9,7 +9,6 @@ class TestOvertimeType(unittest.TestCase):
|
||||
|
||||
def create_overtime_type(**args):
|
||||
args = frappe._dict(args)
|
||||
print(args.employee)
|
||||
overtime_type = frappe.new_doc("Overtime Type")
|
||||
overtime_type.name = "Test Overtime"
|
||||
overtime_type.applicable_for = args.applicable_for or "Employee"
|
||||
|
||||
Reference in New Issue
Block a user