Odoo Help


How to write a _read_group_state function?

Bréndou Serge Eric
on 6/3/14, 6:22 AM 1,284 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?

On 1/29/15, 10:28 AM


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


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.


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

1 follower(s)


Asked: 6/3/14, 6:22 AM
Seen: 1284 times
Last updated: 3/16/15, 8:10 AM