Browse Source

Audit repor index error fix

master
venkataakhil 11 months ago
parent
commit
5959a39765
  1. 42
      smart_service/transactions/report/audit_report/audit_report.py

42
smart_service/transactions/report/audit_report/audit_report.py

@ -49,7 +49,6 @@ def get_data(filters):
if validation_flag:
return data
else:
frappe.log_error('Audit report',str(data))
return []
return data
@ -99,11 +98,13 @@ def modify_data(data_input, filter_parent):
for j in ss_map_append:
val = j['procedure_name']
proc = j['procedure']
proc_map, proc_size = get_parent_map(ss_map[val], 'procedure_name')
proc_map, proc_size = get_parent_map(
ss_map[val], 'procedure_name')
proc_values_dic = append_to_dic3(
proc_map, proc_size, j, indent=3, header=0, procedure=proc)
proc_length = status_length_append(proc_values_dic, 'Procedure')
proc_length = status_length_append(
proc_values_dic, 'Procedure')
j['active_status'] = j['active_status'] + ' / ' + proc_length
list1.append(j)
@ -112,20 +113,22 @@ def modify_data(data_input, filter_parent):
proc_map[pm], 'step_name')
step_length = status_length_append(steps_size, 'Step')
list1.append({'procedure_name': pm, 'indent': 3, 'header': 0,
'active_status': step_length, 'modified': ''})
'active_status': step_length, 'modified': ''})
for sl in step_list:
list1.append({'procedure_name': sl, 'indent': 4,
'header': 0, 'active_status': '', 'modified': ''})
'header': 0, 'active_status': '', 'modified': ''})
for ss in step_list[sl]:
ss.update({'procedure_name': ss['content_type']})
list1.append(ss)
append_data = add_duplicate_data(list1)
append_data = remove_duplicate_and_header(append_data)
# frappe.msgprint(str(append_data))
return True, append_data
except Exception as e:
frappe.log_error('Audit report_modify ',str(e))
return False, str(e)
frappe.log_error('Audit report', frappe.get_traceback())
False, None
def append_to_dic1(map_data, indent, header):
map_data_append = []
@ -231,20 +234,21 @@ def append_to_dic3(map_data, proc_size, j, indent, header, procedure):
for cus in range(len(custom_lang)):
if len(list1[cus]) > 0:
if i<len(list1[cus]):
# frappe.msgprint(str(list1[cus]))
if list1[cus][i][0] == 1:
dic1['{}_active_status'.format(custom_lang[cus]['lang_code'])] = str(
list1[cus][i][0]) + " Step"
else:
dic1['{}_active_status'.format(custom_lang[cus]['lang_code'])] = str(
list1[cus][i][0]) + " Steps"
if list1[cus][i][0] == 1:
dic1['{}_active_status'.format(custom_lang[cus]['lang_code'])] = str(
list1[cus][i][0]) + " Step"
else:
dic1['{}_active_status'.format(custom_lang[cus]['lang_code'])] = str(
list1[cus][i][0]) + " Steps"
# Append modified date
dic1['{}_modified'.format(
custom_lang[cus]['lang_code'])] = list1[cus][i][1]
# Append modified date
dic1['{}_modified'.format(
custom_lang[cus]['lang_code'])] = list1[cus][i][1]
dic2.update(dic1)
proc_dict.update(dic1)
dic2.update(dic1)
proc_dict.update(dic1)
i += 1
map_data_append.append(proc_dict)
return map_data_append

Loading…
Cancel
Save