Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


[Solved] Close window on button press

Grahame Jordan
on 3/4/13, 4:29 PM 2,604 views


I have a perplexing problem with buttons and closing a window in 6.1.

I have a one2many list. When I press the edit button in the first column a window opens.

The window has a Save and Cancel button at the top left and I have created a couple of buttons type="object" which call a function.

At the end of the function I return: return {'type': 'ir.actions.act_window_close'}

The function does its processing, but the window does not close by itself.

Am I doing something wrong or does the API treat one2many lists differently. Is there a workaround?


Grahame Jordan

Grahame Jordan
On 3/5/14, 12:47 AM

Well to answer my own question:

Opening a window from a many2one widget and providing other buttons than the provided "Save", "Cancel" on the top left will let you do function call (type="object") but will not close if you: return {'return':True, 'type':'ir.actions.act_window_close' }

If you want your ui-dialog to close on your custom button press you must return the view of the form you wish to return to: ie. return from function_name():

        view = { 
        'name':_("Your View Title"),
        'view_mode': 'form',
        'view_id': False,
        'view_type': 'form',
        'res_model': 'my.table',
        'res_id': res_id,
        'type': 'ir.actions.act_window',
        'nodestroy': True,
        'target': 'self',
        'domain': '[]',
        'context': context
    return view

Hi, do you know how to archive that directly on the web interface without edit py or xml files?

on 4/23/15, 5:20 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 3/4/13, 4:29 PM
Seen: 2604 times
Last updated: 7/27/16, 2:49 AM