تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
7 الردود
25888 أدوات العرض

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.

الصورة الرمزية
إهمال
أفضل إجابة

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

return {'type': 'ir.actions.act_window_close'}
الصورة الرمزية
إهمال
الكاتب

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

أفضل إجابة

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

الصورة الرمزية
إهمال
أفضل إجابة

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 )
الصورة الرمزية
إهمال
أفضل إجابة

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?

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Thanks.

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 20
13732
1
مارس 21
4769
3
مارس 15
9917
1
أكتوبر 23
4055
2
فبراير 23
3344