This question has been flagged
1 Reply
3097 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?

Avatar
Discard
Best Answer

Hello Rosey,

You can override read_group method to fulfill you requirments.

From there you can raise an exception.

Example:

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)

Thanks

Avatar
Discard
Author

Thanks.

Author

https://www.odoo.com/forum/help-1/question/i-added-a-boolean-field-in-my-search-view-as-group-by-but-when-i-grouped-the-boolean-field-its-search-name-shows-as-true-how-can-i-change-true-to-my-field-name-71958

Author

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