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

Why does the calendar event does not allow the user to group by anything?

By
Glen Sojo
on 12/4/14, 3:30 PM 334 views

I have found this method in the calendar.py file of the calendar module. This method is does not allow the user to group using any criteria, because it removes from the result the 'group_count' value

#remove the count, since the value is not consistent with the result of the search when expand the group
            for groupname in groupby:
                if result.get(groupname + "_count"):
                    del result[groupname + "_count"]

I don't know why the are removing that field. This is the complete method

def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False, lazy=True):
        context = dict(context or {})

        if 'date' in groupby:
            raise osv.except_osv(_('Warning!'), _('Group by date is not supported, use the calendar view instead.'))
        virtual_id = context.get('virtual_id', True)
        context.update({'virtual_id': False})
        res = super(calendar_event, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby, lazy=lazy)
        for result in res:
            #remove the count, since the value is not consistent with the result of the search when expand the group
            for groupname in groupby:
                if result.get(groupname + "_count"):
                    del result[groupname + "_count"]
            result.get('__context', {}).update({'virtual_id': virtual_id})
        return res

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

0 follower(s)

Stats

Asked: 12/4/14, 3:30 PM
Seen: 334 times
Last updated: 3/16/15, 8:10 AM