提示框有三种写法
1.检查业务逻辑中的错误,终止代码执行,显示错误或警告信息:
raise osv.except_osv(_('Error!'), _(
'The contact you created does not have an email address。'))
2.字段的 onchange 事件中返回值,同时返回提示信息:
@api.onchange(‘u’)
def compute_price(self):
if self.u < 0:
return {
‘warning’: {
‘title’: “Error!”,
‘message’: “The contact you created does not have an email address”,
},
}
3.视图中 button 按钮点击时显示确认信息:【直接加上"confirm"属性,就可以实现,点击按钮的时候,弹出窗口,提示“是否确认操作”的提示框】
<button name="cancel_voucher" string="Cancel Voucher" type="object" states="posted" confirm="The contact you created does not have an email address"/>