Tintumon M
Tintumon M

Reputation: 1164

Button is not working inside Wizard

I am new to OpenERP, I have placed a button in wizard. But when I click on the button the wizard automatically closed without calling the function. Can anyone explain, why?

Upvotes: 0

Views: 1334

Answers (1)

ChesuCR
ChesuCR

Reputation: 9620

Make sure that you have the attribute type=object

<button name="do_compute" string="Compute" type="object" icon="gtk-apply" class="oe_highlight"/>

The name of the method you are going to run in this example is do_compute. And you must return something like this:

@api.multi
def do_compute(self):
    self.ensure_one()

    # operations

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

Upvotes: 1

Related Questions