Odoo Help

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 482 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

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.

Register

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

0 follower(s)

Stats

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