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, }