1
votes

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',
    }
3

3 Answers

2
votes

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

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

I was the same, and I went out to click an empty form, look and look and I realized that I made a rookie mistake, there was added in the sight openerp.py sounds silly but check that part.

0
votes

The simplest thing to do is do avoid closing the wizard :

@api.multi
def null_action(self):
    return {
        "type": "set_scrollTop",
    }

As the type is used to call any method on the class ActionManager (javascript)