title: one2many field get row number
body: <p>I have a module contain one2many filed.</p>
  
  <p>while I create data line in this o2m field, I'd like to append a row number to it.</p>
  
  <p>I have try some method that I found in forum, like <a href="https://www.odoo.com/es_ES/forum/ayuda-1/question/how-to-get-a-virtual-recordset-from-an-ordinary-recordset-111286#answer-111330" rel="nofollow noreferrer">this link</a>.</p>
  
  <p>but since I have no function called _onchange_partner_id() , I don't know how to use it.</p>
  
  <p>or <a href="https://www.odoo.com/fr_FR/forum/aide-1/question/count-rows-of-one2many-field-numbering-positions-50603" rel="nofollow noreferrer">this link</a> .</p>
  
  <p>but it seems like an old version method that I can't get well.</p>
  
  <pre class="lang-py prettyprint-override"><code>class YcWeight(models.Model):
  
      _name = "yc.weight"
      customer_detail_ids = fields.One2many("yc.weight.details", "name", "customer details")
  
  class YcWeightDetails(models.Model):
      _name = "yc.weight.details"
  
      name = fields.Many2one("yc.weight", "weight detail list", ondelete="cascade")
      no = fields.Integer("row number")
  
  </code></pre>
  
  <p>the "no" is a field that I want to show number of row count.
  my problem is :</p>
  
  <p>how can I get get the number of rows?</p>
  
  <p>since onchage decorated function can't get data from db.</p>