跳至内容
菜单
此问题已终结
2 回复
2877 查看

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?

形象
丢弃
最佳答案

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!!

形象
丢弃
编写者

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

编写者

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

thank you

最佳答案

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',

}

形象
丢弃
相关帖文 回复 查看 活动
0
7月 18
2518
2
10月 16
5188
3
10月 15
4579
1
2月 25
12502
1
9月 17
3591