对象按钮don';python中的t调用方法

对象按钮don';python中的t调用方法,python,openerp,Python,Openerp,我试图用以下按钮调用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="c

我试图用以下按钮调用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>

致以最诚挚的问候

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

@api.one
def execute(self):
    pass

@api.one
def cancel(self):
    pass

(或者多个而不是一个。)

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

@api.one
def execute(self):
    pass

@api.one
def cancel(self):
    pass

(或者多个而不是一个。)

你如何调用函数?如果你能提供函数原型,会有用吗
name=“execute()”
@ATLUS不,它不起作用。你如何调用函数?如果你能提供函数原型,会很有用。总之,我用code编辑了我的代码。你不只是在方法调用中添加括号吗
name=“execute()”
@ATLUS不,它当然不会工作,因为我放错了版本。我将在线编辑。请再看一遍好吗?1-控制视图的模型与包含这两个方法的类的模型相同。2-您使用的是哪个版本的odoo?嗨,是的,型号是一样的。当然,我用的是V9,因为我放错了版本。我将在线编辑。请再看一遍好吗?1-控制视图的模型与包含这两个方法的类的模型相同。2-您使用的是哪个版本的odoo?嗨,是的,型号是一样的。我用的是v9