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

I have one2many of model A to B.

class A:

    the_bs: fields.one2many("B")

From A form view I click on one of the B items and B form view is shown with a pop up. There I have set a button and I would like to close B form when I click on it.

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

To close the current open window from a button action just:

return {'type': 'ir.actions.act_window_close'}
Ảnh đại diện
Huỷ bỏ
Tác giả

Hi, Axel. That´s how it is supposed to work but it doesn´t. Eso es lo que se supone que se haga, pero no funciona.

Then something is breaking your js code. Actionmanager if i remember ok is the one responsible for this. You need to debug to find what is going on

Câu trả lời hay nhất

Maybe make the button returns the action of the A form view (if A record still in context, else, just return A tree view)

Update:

you can try this then https://www.odoo.com/fr_FR/forum/help-1/question/solved-close-window-on-button-press-4348

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

Just use:

<button data-dismiss="modal" string="Close my modal"/> in your view. 

I waste some time, while dig this, because this dont work if attribute "type"
of the button is set to anything )
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi py, I got the same issue, I try your solution https://www.odoo.com/fr_FR/forum/help-1/question/solved-close-window-on-button-press-4348, but It doesn't work, any idea?

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

Thanks.

I already tried that. The result is that the action takes effect in the background window. The popup stays open.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 20
13605
1
thg 3 21
4633
3
thg 3 15
9709
1
thg 10 23
3852
2
thg 2 23
3177