Hi,
I need to warning when user change my fields.selection.
I create a function onchange and works when I edit the registry but the problem is this field have a default value and when I create a new registry the onchange function is called again. I tried resolve the problem like this:
def onchange_sourcebilling(self, cr, uid, ids, sourcebilling, context=None):
result = {}
if not sourcebilling:
return {}
is_new = self.browse(cr, uid, ids, context)
if is_new.context is None:
raise osv.except_osv(_('Atenção!'),
_('Tem a certeza que quer alterar este campo?'))
return {'value': result}
But this doesn't work like I want. When I create a new field the warning doesn't appear, that is good, but with this code, while I don't save the registry the warning doesn't work.
Basically I need the warning when user change my field selection only and not when the user click in the button "Create". In this moment the warning don't appear when I click on button "Create" but if I change the fields.selection the warning doesn't work. When I save registry works fine.
↧