Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
9359 Lượt xem

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.


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I found a solution:

return {

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

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

'view_type': 'form',

'view_mode': 'tree,form',

}

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

        }

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 23
18299
1
thg 7 17
4298
11
thg 9 21
31999
1
thg 12 18
5587
2
thg 11 18
7889