Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
3189 Vizualizări

So I've made this function  It works great when the type of view it's tree but kanban is showing me this error

TypeError: Cannot read property 'context' of undefined


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)


Imagine profil
Abandonează
Cel mai bun răspuns

Hi,  Wildhen


You have defined wrong parameters inside the method that's why you are getting this issue.

Kindly follow below parameter in order to fix this issue.

def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):

Thanks,
Ashish Singh(Team Lead)
Webkul Software Private Limited

Imagine profil
Abandonează
Autor Cel mai bun răspuns
fields_view_get(view_id=view_id, view_type=view_type)
Imagine profil
Abandonează