每当在 Odoo 9 中按下模块的安装按钮时,我想执行一些任务

I want to perform some task whenever the install button is pressed in Odoo 9 for a module

我尝试重写模型的 button_install() 方法 ir.module.module

class module(models.Model):
    _inherit = 'ir.module.module'

    @api.multi
    def button_install(self):
        raise Warning("----Cannot Install---")

但是上面的方法没有执行

有人可以帮忙吗?

模块公式button_immediate_install()被使用,尝试覆盖此方法。