Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

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

By
hellequin
on 2/26/14, 10:05 AM 1,242 views

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'})
0
Rafael Reuber
On 2/26/14, 8:51 PM

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'})

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/26/14, 10:05 AM
Seen: 1242 times
Last updated: 3/16/15, 8:10 AM