Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
2881 Vistas

In odoo9 I have these 2 views.

16 account.analytic.line.tree Tree account.analytic.line analytic.view_account_analytic_line_tree

16 account.analytic.line.tree Tree account.analytic.line hr_timesheet.hr_timesheet_line_tree


now when I make a function with a return, and I say them this:

 return {

'type': 'ir.actions.act_window',

'res_model': 'account.analytic.line',

'view_type': 'form',

'view_mode': 'tree',

}


I get every time on the analytic.view_account_analytic_line_tree view. But I wan't to go to the other view.

How can I fix this?

Avatar
Descartar
Mejor respuesta

wizards,

you can pass you new tree view id to show that view

view_id = record_id = self.env.ref('module_name.xml_id_of_record').id

 return {

'type': 'ir.actions.act_window',

'res_model': 'account.analytic.line',

'view_type': 'form',

'view_mode': 'tree',

'view_id': view_id

}


Hope it helps!!

Avatar
Descartar
Autor

if I add this : view_id = self.env.ref('account.analytic.line.hr_timesheet.hr_timesheet_line_tree').id

#return sequence geändert zu 15..... not working

return {

'type': 'ir.actions.act_window',

'res_model': 'account.analytic.line',

'view_type': 'form',

'view_mode': 'tree',

'view_id': view_id, #1065

#'view_id': 'hr_timesheet.hr_timesheet_line_tree',

}

I get this error:

ValueError: External ID not found in the system: account.analytic.line.hr_timesheet_line_tree

Autor

I have fixed it, I need to take the right module : hr_timesheet.

thank you

Mejor respuesta

return {

'name': 'any Name',

'view_type': 'form',

"view_mode": 'tree',

'res_model': 'account.analytic.line',

'type': 'ir.actions.act_window',

'res_id': id, # e.g. self.id

'target': 'current',

}

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
jul 18
2518
2
oct 16
5189
3
oct 15
4584
1
feb 25
12503
1
sept 17
3591