This question has been flagged
1 Reply
3169 Views

I'm trying to write the _read_group_state function in order to displays all states columns in Kanban even if there is no record.

here is the code i tryed: 

def _read_group_state(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):
        print '_read_group_state'
        access_rights_uid = access_rights_uid or uid
        renting_obj = self.pool.get('mymodule.renting')
        
        renting_ids = renting_obj._search(cr, uid, domain, order=read_group_order, access_rights_uid=access_rights_uid, context=context)
        result = renting_obj.name_get(cr, access_rights_uid, renting_ids, context=context)
        
        result.sort(lambda x,y: cmp(renting_ids.index(x[0]), renting_ids.index(y[0])))
        
        states = {}
        for renting in renting_obj.browse(cr, access_rights_uid, renting_ids, context):
            states[renting.id] = renting.state or False
        
        return result, states

But that returns next error : AssertionError: M2O-like pair expected, got u'draft'

can you help me?

Avatar
Discard
Best Answer

Hello,

There is a workaround documented by Ludwik Trammer on his blog that worked in my context.
I hope it will be helpful for you.

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

Avatar
Discard