Help

0

How to display an error message: There are no articles at the click of a button ?

Avatar
hellequin

I try to add a error box on my function button but I do not know how to do it..

I try this :

def testError(self, cr, uid, ids, context=None):
    for line in self.browse(cr, uid, ids, context=context):
        if line.invoiced:
            raise osv.except_osv(_('Invalid Action!'), _('Test.'))
    return self.write(cr, uid, ids, {'state': 'draft'})
Avatar
Discard
1 Answer
0
Avatar
Rafael Reuber
Best Answer

Try this. This will show a popup message.

def testError(self, cr, uid, ids, context=None):
    for line in self.browse(cr, uid, ids, context=context):
        if line.invoiced:
            warning = { 'title': 'Warning!', 'message' : 'Invalid action!'}
            return {'warning': warning}
    return self.write(cr, uid, ids, {'state': 'draft'})
Avatar
Discard