error:
File "c:\program files (x86)\odoo 12.0\server\odoo\addons\assignments_report\report\assignment_report.py", line 45, in get_objects dict[line.student_id.name][0].update(codes) IndexError: list index out of range Error to render compiling AST IndexError: list index out of range Template: 1016 Path: /templates/t/t/t/div/div/t/table[2]/tbody/tr Node: <tr t-foreach="get_objects(docs)" t-as="a"> <td class="text-center"> <span t-esc="a_index+1"/> </td> <td class="text-left"> <span t-raw="'%s' % a_value if a_value else''"/> </td> <t t-set="total_marks" t-value="0"/> <td t-foreach="a_value" t-as="lines"> <t class="text-right"> <!-- <span t-raw="'%s' % lines[a_index] if lines[a_index] else''"/>--> <!--<t t-set="total_marks" t-value="total_marks + a_value[lines_index]"/>--> </t> </td> <td> <span> <t t-esc="total_marks"/> </span> </td> </tr>
def get_objects(self, records):
dict = {}
for object in records:
for line in object.assignment_sub_line:
marks1 = []
codes={}
if line.student_id.name not in dict:
#marks1.append(line.marks)
codes[line.assignment_id.assignment_type_id.code] = line.marks
marks1.append(codes)
dict[line.student_id.name]=marks1
marks1.clear()
codes.clear()
if line.student_id.name in dict:
codes[line.assignment_id.assignment_type_id.code] = line.marks
dict[line.student_id.name][0].update(codes)
codes.clear()
return dict
the error is here
dict[line.student_id.name][0].update(codes)
please give me solution
Use Logging library to check the value of dict[line.student_id.name]
Here you are how to use logging in Odoo:
https://www.odoo.yenthevg.com/logging-in-odoo/