when i access employee record and store in list, when i assign variable top five records it show me that particular error
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/flectra/http.py", line 658, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python3/dist-packages/flectra/http.py", line 314, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/usr/lib/python3/dist-packages/flectra/tools/pycompat.py", line 87, in reraise raise value File "/usr/lib/python3/dist-packages/flectra/http.py", line 700, in dispatch result = self._call_function(**self.params) File "/usr/lib/python3/dist-packages/flectra/http.py", line 346, in _call_function return checked_call(self.db, *args, **kwargs) File "/usr/lib/python3/dist-packages/flectra/service/model.py", line 97, in wrapper return f(dbname, *args, **kwargs) File "/usr/lib/python3/dist-packages/flectra/http.py", line 339, in checked_call result = self.endpoint(*a, **kw) File "/usr/lib/python3/dist-packages/flectra/http.py", line 944, in __call__ return self.method(*args, **kw) File "/usr/lib/python3/dist-packages/flectra/http.py", line 522, in response_wrap response = f(*args, **kw) File "/usr/lib/python3/dist-packages/flectra/addons/web/controllers/main.py", line 1090, in call_kw return self._call_kw(model, method, args, kwargs) File "/usr/lib/python3/dist-packages/flectra/addons/web/controllers/main.py", line 1082, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/usr/lib/python3/dist-packages/flectra/api.py", line 697, in call_kw return call_kw_model(method, model, args, kwargs) File "/usr/lib/python3/dist-packages/flectra/api.py", line 682, in call_kw_model result = method(recs, *args, **kwargs) File "/mnt/extra-addons/payroll_dashboard/models/payroll_dashboard.py", line 246, in get_payroll_details h_employee2 = lines[1] IndexError: list index out of rangelines = []
for i in payslips:
names = i.employee_id.name
lines.append(names)
print("\n\n",lines)
for j in range(len(lines)):
lines.sort()
for l in i.line_ids:
if l.code =='NET':
h_employee1 = lines[0]
h_employee2 = lines[1]
h_employee3 = lines[2]
h_employee4 = lines[3]
h_employee5 = lines[4]