Odoo Help


Alert Box in search view in openerp 7.0?

on 1/2/15, 5:27 AM 911 views

I have two group by fields - field 1 and field 2.

And two subdivisions for field 1. These subdivisions have no relation with field 2.

When i select field 1 -- subdivision 1/subdivision 2 -->it shows the corresponding result.

If i select field 2 -- subdivision 1/subdivision 2 --> I need to dispaly an alert message. How should i display an alert box in search view?

Nishant Jogi
On 1/2/15, 8:06 AM

Hello Rosey,

You can override read_group method to fulfill you requirments.

From there you can raise an exception.


def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False, lazy=True):
        if 'field1' in groupby and 'field2' in groupby:
            raise osv.except_osv(_('Warning!'), _('You can not group by both fields.'))
        return super(your_class_name, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby, lazy=lazy)



on 1/3/15, 6:46 AM


on 1/3/15, 6:47 AM

Can you please help me to solve the issue in the above question?

on 1/3/15, 6:48 AM

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/2/15, 5:27 AM
Seen: 911 times
Last updated: 3/16/15, 8:10 AM