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

Full groups / stages in Kanban view _group_by_full

By
Lucas Huber
on 2/12/16, 7:11 AM 605 views

I did try several solutions to including empty groups in my Kanban view.

First I did copy more or less the OSV solution from the Odoo Project module. But that didn't work:

def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_righ        ts_uid=None, context=None):    
    if context is None: context = {}
    stage_obj = self.pool.get('project.task.type')
    order = stage_obj._order
    access_rights_uid = access_rights_uid or uid
    if read_group_order == 'state_def desc':
        order = '%s desc' % order
    if 'default_project_id' in context:
         search_domain = ['|', ('project_ids', '=', context['default_project_id']), ('id            ', 'in', ids)]
    else:
         search_domain = [('id', 'in', ids)]
    stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid             =access_rights_uid, context=context)
    result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context)     # restore order of the search
    result.sort(lambda x, y: cmp(stage_ids.index(x[0]), stage_ids.index(y[0])))
    fold = {}
       for stage in stage_obj.browse(cr, access_rights_uid, stage_ids, context=context): fold[stage.id] = stage.fold or False
    return result, fold
_group_by_full = { 'stage_id': _read_group_stage_ids, }

But then I found a simpler solution according the tutorial from Ludwik Trammer.

\http://ludwiktrammer.github.io/odoo/odoo-grouping-kanban-view-empty.html

@api.model
def _read_group_stage_ids(self, present_ids, domain, **kwargs):
    # project_id = self._resolve_project_id_from_context()
    result = self.env['project.task.type'].search([]).name_get()
    return result, None

_group_by_full = { 'stage_id': _read_group_stage_ids, }

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

1 follower(s)

Stats

Asked: 2/12/16, 7:11 AM
Seen: 605 times
Last updated: 2/12/16, 7:14 AM