fix: showing wrong record (#21884)

This commit is contained in:
Anurag Mishra 2020-05-25 19:23:17 +05:30 committed by GitHub
parent 0a147d5c76
commit a7f42f7256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View File

@ -89,11 +89,10 @@
"docstatus": 0, "docstatus": 0,
"doctype": "Desk Page", "doctype": "Desk Page",
"extends_another_page": 0, "extends_another_page": 0,
"hide_custom": 0,
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"label": "HR", "label": "HR",
"modified": "2020-05-20 11:20:54.255557", "modified": "2020-05-23 12:41:52.543438",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "HR", "name": "HR",
@ -127,7 +126,7 @@
"type": "DocType" "type": "DocType"
}, },
{ {
"label": "Salary Register", "label": "Monthly Attendance Sheet",
"link_to": "Monthly Attendance Sheet", "link_to": "Monthly Attendance Sheet",
"type": "Report" "type": "Report"
}, },

View File

@ -135,7 +135,7 @@ def add_data(employee_map, att_map, filters, holiday_map, conditions, default_ho
row += [emp, emp_det.employee_name] row += [emp, emp_det.employee_name]
total_p = total_a = total_l = total_h = total_um= 0.0 total_p = total_a = total_l = total_h = total_um= 0.0
ggg = [] emp_status_map = []
for day in range(filters["total_days_in_month"]): for day in range(filters["total_days_in_month"]):
status = None status = None
status = att_map.get(emp).get(day + 1) status = att_map.get(emp).get(day + 1)
@ -152,11 +152,10 @@ def add_data(employee_map, att_map, filters, holiday_map, conditions, default_ho
status = "Holiday" status = "Holiday"
total_h += 1 total_h += 1
ggg.append(status_map.get(status, "")) abbr = status_map.get(status, "")
emp_status_map.append(abbr)
if not filters.summarized_view: if filters.summarized_view:
row += ggg
else:
if status == "Present" or status == "Work From Home": if status == "Present" or status == "Work From Home":
total_p += 1 total_p += 1
elif status == "Absent": elif status == "Absent":
@ -170,6 +169,9 @@ def add_data(employee_map, att_map, filters, holiday_map, conditions, default_ho
elif not status: elif not status:
total_um += 1 total_um += 1
if not filters.summarized_view:
row += emp_status_map
if filters.summarized_view: if filters.summarized_view:
row += [total_p, total_l, total_a, total_h, total_um] row += [total_p, total_l, total_a, total_h, total_um]
@ -203,7 +205,7 @@ def add_data(employee_map, att_map, filters, holiday_map, conditions, default_ho
row.append("0.0") row.append("0.0")
row.extend([time_default_counts[0][0],time_default_counts[0][1]]) row.extend([time_default_counts[0][0],time_default_counts[0][1]])
emp_att_map[emp] = ggg emp_att_map[emp] = emp_status_map
record.append(row) record.append(row)
return record, emp_att_map return record, emp_att_map
@ -216,7 +218,7 @@ def get_columns(filters):
columns = [_(filters.group_by)+ ":Link/Branch:120"] columns = [_(filters.group_by)+ ":Link/Branch:120"]
columns += [ columns += [
_("Employee") + ":Link/Employee:120", _("Employee Name") + ":Link/Employee:120" _("Employee") + ":Link/Employee:120", _("Employee Name") + ":Data/:120"
] ]
days = [] days = []
for day in range(filters["total_days_in_month"]): for day in range(filters["total_days_in_month"]):