Odoo Help


[SOLVED] How to use oe_kanban_list_many2many style in OpenERP7?

Juan Formoso
on 10/15/14, 5:16 AM 1,575 views

I had a model (res.partner) with a many2many field property (courses). It showed the courses a partner had joined to. In the kanban view of partners, I used the class oe_kanban_list_many2many, and I could see below the partners' name a list of tags indicating the courses the partner had joined to.

But, the situation changed. I needed to store some additional information about the relationship between partners and courses (joining_date), so I had to change the kind of the field courses (from many2many to one2many), and create a new intermediate table with the properties partner_id(many2one), course_id (many2one), and joining_date.

So, in summary:



_columns = { ... 'courses': fields.many2many('course', 'res_partner_course_rel', 'partner_id', 'course_id', 'Courses'), ... }

kanban view

<span class="oe_kanban_list_many2many"> <field name="courses"/> </span>



_columns = { 'partner_id': fields.many2one('res.partner', 'Partner'), 'course_id': fields.many2one('course', 'Course'), 'date': fields.date('Joining Date'), }


_columns = { ... 'courses': fields.one2many('res.partner.course', 'partner_id'), ... }

kanban view

<span class="oe_kanban_list_one2many"> <field name="courses"/> </span>

In the kanban, I want to keep seeing on tags the courses a partner has joined to, but instead of that, I am seeing (n records). For example, if the partner 'John' has joined to two courses, I see, below 'John',(2 records).

How can I show the courses as before?

Juan Formoso
On 10/15/14, 12:44 PM

Finally, I found a solution. May be is not the best, but works, and I hope it helps to anyone.

I declared a new field in res.partner, of type function:

'courses': fields.function(

Above this, I declared the function _get_courses, in which I make a SQL query to get all the courses a partner has joined. And the function returns a dictionary with this structure (let's show an example with ficticious data): {partner_id_1: [joined_course_id_1, joined_course_id_2,], partner_id_2: [joined_course_id_1,], partner_id_3: [joined_course_id_5, joined_course_id_8,],} ...

Then, in the XML kanban view, we show our new functional field inside the tags with class oe_kanban_list_many2many:

<span class="oe_kanban_list_many2many">
     <field name="courses"/>

And that's it, now I can see into tags every course a partner has joined.


Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 10/15/14, 8:25 AM

I think presently you don't have such option, but you can achieve it by writing your own widget....

I was also looking for such option, but later my requiment changed, hence dropped the idea of continuing it further...

Do share the solution if you found one... :)

Ok, thank you, I'll do that.

Juan Formoso
on 10/15/14, 9:21 AM

Ey, after a long time racking my brains, I finally managed a way to do it! I am going to post the answer.

Juan Formoso
on 10/15/14, 12:30 PM

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

2 follower(s)


Asked: 10/15/14, 5:16 AM
Seen: 1575 times
Last updated: 3/16/15, 8:10 AM