对象按钮不调用 python 中的方法

Object button don't call method in python

我正在尝试使用以下按钮调用 python 中的函数:

<form string="Settings" class="oe_form_configuration">
     <header>
         <button string="Apply" type="object" name="execute" class="oe_highlight"/>
         <button string="Cancel" type="object" name="cancel" class="oe_link"/>
    </header>
     ...
</form>

但是,他们永远不会被调用。过了一段时间,我看到就是调用update的方法,也就是def write(...).

谁能帮我理解这个问题?

编辑: 实际上,我从方法中删除了所有逻辑:

def execute(self, cr, uid, ids, context=None):
    pass

def cancel(self, cr, uid, ids, context=None):
    pass

此致

不要使用旧的 v7 API,请尝试 v8:

@api.one
def execute(self):
    pass

@api.one
def cancel(self):
    pass

(或 multi 而不是 oneHere's the difference