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

How can I switch to another view after I click a new created button?:

<button name="start_work" attrs="{'invisible':[('work_time_status','!=', True)]}" string="Stop Work" type="object" class="oe_highlight"/>

In the python code in the function start_work.


アバター
破棄
著作者 最善の回答

I found a solution:

return {

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

'res_model': 'project.task.work',

'view_type': 'form',

'view_mode': 'tree,form',

}

アバター
破棄
最善の回答

This is a way to switch a other view after clicking button

<button name="start_work" attrs="{'invisible':[('work_time_status','!=', True)]}" string="Stop Work" type="object" class="oe_highlight"/>

@api.multi

def start_work(self):

course_form = self.env.ref('your form view name', False)

return {

'name': 'New Course',

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

'res_model': 'your module name',

'view_type': 'form',

'view_mode': 'tree,form',

'target': 'self',

'views': [(course_form.id, 'form')],

'view_id': 'course_form.id',

'flags': {'action_buttons': True},

        }

アバター
破棄
著作者

this is not working, I need an example on the task view

関連投稿 返信 ビュー 活動
2
12月 23
18311
1
7月 17
4313
11
9月 21
32018
1
12月 18
5595
2
11月 18
7899