[ODOO 10] : How to render or display one2many data on new dialog in website?

Hello All,

My GOAL is to display the One2many fields data of current record in the dialog box. 

Either should be on button click or using HREF, dialog should open and data should be display there.

This is what i did till now.

1. I have defined 1 div which is opening on the button click of current page and it display all the data of One2many perfectly but only for the First Record. 

This is my template strctuture

<t t-foreach="teams" t-as="team">
<div class="col-xs-8 col-md-8">
<div class="col-xs-4 col-md-4" style="vertical-align:top;display: table-cell;">
<span itemprop="image" t-field="team.image" t-options="{'widget': 'image', 'resize': None if product_image_big else '400x400', 'zoom': 'image'}"
t-att-alt="" />
<div class="col-xs-4 col-md-4" style="vertical-align:middle;display: table-cell;padding-top: 100px;">
<b>Team : </b> <t t-esc="" /> <br/>
<b>Owner : </b><t t-esc="" /> <br/>
<b>Venue :</b> <t t-esc="team.venue" /> <br/>
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-oe-id="team" data-target="#myModal">Team Detail</button>
<div class="modal fade" id="myModal" data-toggle="modal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Team Details</h4>
<div class="modal-body">
<div class="btn-toolbar">
<button class="btn btn-primary">Players</button>
<t t-esc=""/><t t-esc=""/>
<div class="well">
<table class="table">
<th>Player Name</th>
<th>Player Contact</th>
<th>Player Email</th>
<th style="width: 36px;"></th>
<tr t-foreach="team.player_ids" t-as="i">
<td><t t-esc="" /></td>
<td><t t-esc="" /></td>
<td><t t-esc="" /></td>
<a href="user.html"><i class="icon-pencil"></i></a>
<a href="#myModal" role="button" data-toggle="modal"><i class="icon-remove"></i></a>

There are number of Teams display in page, each team having players detail. Added button for each team so whenever user will click on the button can see the players details.

Please help me to resolve this issue?

Looking forward

Best Regards,

Anil Kesariya

1 Answer
Best Answer


Module "website_sale_options" is the best example for this above question.

Thank you Mustafa kantawala for your help on this.