콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3232 화면

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

아바타
취소