Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
9279 มุมมอง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
Open View from Button แก้ไขแล้ว
2
ธ.ค. 23
18185
1
ก.ค. 17
4209
Hide field in a tree view แก้ไขแล้ว
11
ก.ย. 21
31893
1
ธ.ค. 18
5512
2
พ.ย. 18
7841