This question has been flagged
2 Replies
9555 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,

Avatar
Discard

It affects me too

Best Answer

(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).

Avatar
Discard
Best Answer

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'

Avatar
Discard