So I've made this function It works great when the type of view it's tree but kanban is showing me this error
def fields_view_get(self, view_id=None, view_type='kanban', context=None, toolbar=False, submenu=False):
self.env['ot.general'].search([]).unlink()
sql ="SELECT DISTINCT(count(ot_model.status)) as cant, ot_status.name, ot_status.color FROM ot_model join ot_status on ot_model.status = ot_status.id group by ot_model.status, ot_status.name, ot_status.color"
self.env.cr.execute(sql)
ot = self.env.cr.fetchall()
ot = json.loads(json.dumps(ot))
vals = []
for elem in range(len(ot)):
vals.append({})
for subelem in range(len(ot[elem])):
if subelem == 0:
vals[elem]['cant'] = ot[elem][subelem]
if subelem == 1:
vals[elem]['name'] = ot[elem][subelem]
if subelem == 2:
vals[elem]['color'] = ot[elem][subelem]
print(vals)
self.env['ot.general'].create(vals)
return super(OtStatusGeneral, self).fields_view_get(view_id=view_id, view_type='kanban', toolbar=toolbar, submenu=submenu)