Skip to Content
Menu
This question has been flagged
2 Replies
2204 Views

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
Discard
Best Answer

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
Discard
Author

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

Author

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

thank you

Best Answer

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
Discard
Related Posts Replies Views Activity
0
Jul 18
1742
2
Oct 16
4316
3
Oct 15
3744
1
Jul 21
10990
1
Sep 17
2798