title: Delete records from one2many in odoo
body: <p>I need to delete one2many records in onchange method. I have tried below code.</p>
  
  <p><strong>*.py</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>@api.onchange('abt')
  def _onchange_active(self):
      resident_flat_rel_id =[]
      if self.active == False:
          write=self.write({'resident_flat_rel_ids':[(2,self.resident_flat_rel_ids.id,False)]})
          print'werite', write // prints True.
  </code></pre>
  
  <p>But record doesn't delete from database.</p>
  
  <p><code>resident_flat_rel_ids</code> is one2many field in parent model.</p>