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.

1

How to display group column with no data in OpenERP 7's Kanban View ?

By
edxz
on 9/9/13, 6:57 AM 4,703 views

I want to ask something here about Kanban View in OpenERP 7,

I'm creating a Kanban view for my module. the view is grouped by 4 stage of columns, so when I drag a record to another column the stage of that record will be changed.

but here's the problem: I want to drag a record from stage A to stage B. but when there's no record in stage B the stage B's column will not be displayed until I've a record with stage B , so I can't change the stage by dragging the record because the stage B's column is not visible

so desperate to find the solution, please help me.. thanks guys,

It affects me too

Denis Karataev
on 12/22/13, 1:34 PM
2
Mathieu Benoit
On 2/17/14, 6:12 PM

(Note: I add space on my link because the forum block my post if contain links) I found this : http:// stackoverflow.com/questions/18680375/display-column-with-no-record-in-openerp-7-kanban-view

In the view, you have this : <kanban default_group_by="stage_id">

You need to specify how sort the group in your class.

def _read_group_state(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None): pass

_group_by_full = { 'stage_id': _read_group_stage_ids}

You can check example with crm_lead: View example: http:// bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/crm/crm_lead_view.xml (search

<record model="ir.ui.view" id="crm_case_kanban_view_leads">

) Sort example: http:// bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/crm/crm_lead.py (search

_group_by_full = { 'stage_id': _read_group_stage_ids }

)

I notice, your stage_id is suppose to be an M2O (or whatever key you want to group by).

0
Bréndou Serge Eric
On 6/2/14, 1:10 PM

Please Mathieu Benoit! can you show us how _read_group_state function should look like?

here is the his mine: 

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

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

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: 9/9/13, 6:57 AM
Seen: 4703 times
Last updated: 3/16/15, 8:10 AM