コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
20421 ビュー

I have a piece of Python code that redirects the user to another view when he/she clicks a button. The redirecting is done as follows:

    view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'hr_timesheet', 'hr_timesheet_line_tree')
    view_id = view_ref and view_ref[1] or False

    return {
        'type': 'ir.actions.act_window',
        'name': 'Timesheets',
        'view_mode': 'tree',
        'view_id': view_id,
        'res_model': 'hr.analytic.timesheet',
        'context': context,
     }

This opens the new view into the current window like this:

image description

That works fine, but it would be better if the window opened in an overlay instead. I then added 'target':'new' to the return statement's dictionary, and the result appears like this:

image description

So the overlay opens up, but the create button is missing so you can only access the current rows, not add new ones. Any ideas what could be causing this?

アバター
破棄

I have a similar problem...

最善の回答

Add a flags parameter to the action window:

return {
     'type': 'ir.actions.act_window',
     'name': 'Timesheets',
     'view_mode': 'tree',
     'view_id': view_id,
     'res_model': 'hr.analytic.timesheet',
     'context': context,
     'flags': {'action_buttons': True},
}
アバター
破棄

how to set action button in xml Record model

最善の回答

Hello,

I have a similar question, I want to display the number of record (top right) and the next/previous button.

How can I do this ?

アバター
破棄
関連投稿 返信 ビュー 活動
1
3月 24
3655
7
12月 22
12027
3
6月 21
11297
0
1月 21
2454
2
6月 20
5563