Search code examples
pythonpython-2.7odoo-8odoowizard

Odoo button click destroys wizard


I've placed a button inside a form, but when I open a wizard of this form and click on my button, the wizard is closed.

I tried this code, which re-opens a new form, but this time there is no save button. Why?

@api.multi
def auto_dates(self):

    self.ensure_one()

    #some code      

    return {
        'context': self.env.context,
        'view_type': 'form',
        'view_mode': 'form',
        'res_model': 'stock.production.lot',
        'res_id': self.id,
        'view_id': False,
        'type': 'ir.actions.act_window',
        'target': 'new',
    }

Solution

  • Try to add this key to your return's dictionary:

    'flags': {'action_buttons': True},