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:
BEFORE
res.partner
_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>
NOW
res.partner.course
_columns = { 'partner_id': fields.many2one('res.partner', 'Partner'), 'course_id': fields.many2one('course', 'Course'), 'date': fields.date('Joining Date'), }
res.partner
_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?