title: Odoo 10 - Display Field From One2many in Standard Tree and Calendar Views
body: <p>Thanks to the help of smart people on this site, I now have a nice One2many field in my module that allows me to add multiple order lines just like in the sales module. It works quite well, but now for convenience, I would like to be able to see a certain field within that One2many field in my tree and calendar views. However, when I try to display that field with the method described below, all I get is the number of records. In particular, I want it to display all of the products that were added to the order lines. Here is the relevant code:</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code># -*- coding: utf-8 -*-
  
  from odoo import models, fields, api
  from odoo.addons import decimal_precision as dp
  
  class mymodule_base(models.Model):
      _name = 'mymodule.mymodule'
      _description = 'My Module'
  
      operations = fields.One2many('mymodule.line', 'order_id', 'Operation Lines')
  
  class mymodule_line(models.Model):
      _name = 'mymodule.line'
      _description = 'Order Line'
  
      order_id = fields.Many2one('mymodule.mymodule')
      product_id = fields.Many2one('product.template', string='Repair / Part', required=False)
  </code></pre>
  
  <p><strong>views.xml</strong></p>
  
  <pre><code>&lt;record id="mymodule.calendar" model="ir.ui.view"&gt;
      &lt;field name="name"&gt;MyModule Calendar&lt;/field&gt;
      &lt;field name="model"&gt;mymodule.mymodule&lt;/field&gt;
      &lt;field name="arch" type="xml"&gt;
          &lt;calendar string="Repairs" date_start="date_received" date_stop="date_due" color="state"&gt;
              &lt;field name="operations"&gt;
                  &lt;field name="product_id"/&gt;
              &lt;/field&gt;
          &lt;/calendar&gt;
      &lt;/field&gt;
  &lt;/record&gt;
  
  &lt;record model="ir.ui.view" id="mymodule.list"&gt;
      &lt;field name="name"&gt;MyModule list&lt;/field&gt;
      &lt;field name="model"&gt;mymodule.mymodule&lt;/field&gt;
      &lt;field name="arch" type="xml"&gt;
          &lt;tree&gt;
              &lt;field name="operations"&gt;
                  &lt;field name="product_id"/&gt;
              &lt;/field&gt;
          &lt;/tree&gt;
      &lt;/field&gt;
  &lt;/record&gt;
  </code></pre>
  
  <p>Here is an image of what my list view looks like with the above code: <a href="https://i.stack.imgur.com/6l8Ly.png" rel="nofollow noreferrer">List View</a></p>
  
  <p>I would greatly appreciate any help. Please let me know if I need to further clarify what I'm trying to do.</p>
  
  <p><strong>EDIT</strong>
  I have tried Juan's suggestion, but I still only see numbers, not the product names, in my view. Here is what I did. I am not sure if I followed the instructions correctly.</p>
  
  <p><strong>Under mymodule.line</strong></p>
  
  <pre><code>    product_name = fields.Char(related='product_id.name', store=True)
  </code></pre>
  
  <p><strong>Under list view</strong></p>
  
  <pre><code>            &lt;field name="operations" widget="one2many_list" mode="tree"&gt;
                  &lt;field name="product_id" invisible="True"/&gt;
                  &lt;field name="product_name"/&gt;
              &lt;/field&gt;
  </code></pre>
  
  <p>It doesn't seem to matter whether or not I include these two lines under the operations definition.</p>
  
  <pre><code>                &lt;field name="product_id" invisible="True"/&gt;
                  &lt;field name="product_name"/&gt;
  </code></pre>
  
  <p>I still get the same result.</p>
  
  <p><strong>EDIT 2</strong>
  I have tried adding a related field under mymodule.mymodule as such:</p>
  
  <pre><code>product_name = fields.Char(related='operations.product_id.name')
  </code></pre>
  
  <p>Then, I define this field in my list view like so:</p>
  
  <pre><code>&lt;field name="product_name"/&gt;
  </code></pre>
  
  <p>And this gives me <em>almost</em> what I want, except it only displays the name of <em>one</em> product, not all of them.</p>