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

How to write a _read_group_state function?

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

0
guillaume
On 1/29/15, 10:28 AM

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

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: 6/3/14, 6:22 AM
Seen: 901 times
Last updated: 3/16/15, 8:10 AM