Odoo Help


How to show the cancel/save buttons on a popup form

on 8/31/13, 7:00 AM 13,821 views

How to show the cancel/save buttons on a popup form?

On 10/17/13, 8:54 AM

Add this te the xml form :

<footer> <button name="write" type="object" string="Save"/> or <button name="cancel" string="Cancel" special="cancel" class="oe_link"/> </footer>

is the "write" function available in all py files???

Atchuthan - Technical Consultant, Sodexis Inc
on 10/18/13, 2:51 AM

Yes and you can redefine it by ( def write ....)

on 10/18/13, 7:09 AM
Jamshid Chungath
On 8/1/15, 3:10 AM

after target:'new'

add these

'flags': {'form': {'action_buttons': True}}

and tree view?

Badache Zoubir
on 5/1/17, 8:56 AM

Francesco OpenCode

--Francesco OpenCode--

| 6 8 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 8/31/13, 7:03 AM

When you open a record in modify state, all the popup has got cancel/save button

i am passing form from py file. i want to see save button in pop up buts its not showing my code is return { 'type': 'ir.actions.act_window', 'name': 'Form heading', 'view_mode': 'form', 'view_type': 'form', # 'view_id': view_id, 'res_model': 'calldata1', 'nodestroy': True, #'res_id': this.id, # assuming the many2one


          'context': context,
on 8/31/13, 7:05 AM
Marcin Pieczyński
On 4/6/17, 3:54 AM

Hi everyone

I git similar problem but a little much complicated:

I have three buttons in my popup:

    <button name="subscribe" type="object"
    string="Subscribe" class="oe_highlight"/>
    <button name="subscribe_and_get_labels" type="object"
    string="Subscribe and get labels" class="oe_highlight"/>
    <button special="cancel" string="Cancel"/>

"Subscribe"  - just save the data according to form, and close the window

"Subscribe and get labels" - save the data (as subscribe), return pdf report, and do not close window ! (That is the problem.)

"Close" - close the window.

"Subscribe and get labels" button return pdf by returning:

    {'type': 'ir.actions.act_url',
    'url': '/web/binary/saveas?model=ir.attachment&field=datas&filename_field=name&id=' + str(file.id),
    'target': 'new',

but I would like it additionally to close the popup window.

Jérôme Thériault
On 2/14/17, 11:49 AM

A bit of warning here. A button in a form WILL call python write() on the model, unless there are no writable fields in the view. So having the button specifically call write will have it call the write() method twice. Any button that is not special="cancel" will call the write() method, and this is by design.

Since the button will already call write, the button should define another method it will call afterwards but ONLY if the write() method returns True (on success). So add something like this on the view XML:

<button name="write_success" type="object" string="Save"/> or <button string="Cancel" special="cancel"/>

and define your method like this in the model:

def write_success(self):
    #do stuff, like return an action
#executed only if write() returned True (successful save)

Fernando Gomes
On 5/5/16, 7:28 PM

Hello All,

When I add the 'flags': {'form': {'action_buttons': True}} to the return values I do get the Save and Cancel buttons but the Cancel button does nothing and the Save button saves but does not close the popup window.Is there anyway to add some more values / attributes to the return list so that the popup would act just like the "Create and Edit..." of a M2M field?






| 4 4 6
Hyderabad, India

On 1/24/15, 10:45 AM

I am new to Openerp and also faced the same problem you are facing.

I did some Research on this and came up with the solution in view.js file under web module:

at line  384, after "

 action.flags = _.defaults(action.flags || {}, {

            views_switcher : !popup && !inline,
            search_view : !popup && !inline,
            action_buttons : !popup && !inline,
            sidebar : !popup && !inline,
            pager : (!popup || !form) && !inline,
            display_title : !popup,
            search_disable_custom_filters: action.context && action.context.search_disable_custom_filters

ADD this line: 

"if (popup){
            action.flags.action_buttons = true;

This will show "save" and "Discard" buttons on 'target:new'.

Hope this will help you.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/31/13, 7:00 AM
Seen: 13821 times
Last updated: 4/6/17, 3:54 AM