1
在老版本odoo的(OpenERP的7),我用來做這樣的事情:如何在onchange方法中組合警告消息並更新字段值?在odoo 9
@api.multi
@api.onchange('my_field')
def my_field_change(self, cr, uid, partner_ids, context=None):
if condition is True:
return {
'warning': {'title': _('Error'), 'message': _('Error message'),},
'value': { 'my_field': new_value },
}
如果我想這樣做,在odoo 9,我有這樣的代碼:
@api.multi
@api.onchange('my_field')
def my_field_change(self):
if condition is True:
return {
'warning': {'title': _('Error'), 'message': _('Error message'),},
'value': { 'my_field': new_value },
}
顯示警告窗口,但值字段被忽略。
如何更改該字段的值?
就是這樣!非常感謝 :) – MouTio