Odoo delegation inheritance delete corresponding records of inherited class
<p>I've extended a default class using _inherits.  I am using Odoo v9.</p>

<pre><code>class new_product_uom(models.Model):  
_inherits = {'product.uom':'uomid', }  
_name = "newproduct.uom" 
uomid = fields.Many2one('product.uom',ondelete='cascade', required=True).
#declare variables and functions specific to new_product_uom
sellable = fields.Boolean('Sell products using this UoM?', default=True)
[...]
</code></pre>

<p>If I delete the corresponding record in product.uom, the new_product_uom is deleted.  </p>

<p>If I were to delete a new_product_uom record, nothing happens to the corresponding product_uom record. </p>

<p>I'd like for BOTH records to be automatically deleted when either is deleted.  Is there a way I can do this? Thanks in advance for the help.</p>

<p>Clarification:</p>

<p>product.uom is a default odoo class. It holds UoM records (inches, centimeters, etc).  I use delegation inheritance to extend this class. See:
<a href="https://www.odoo.com/documentation/9.0/howtos/backend.html#model-inheritance" rel="nofollow">https://www.odoo.com/documentation/9.0/howtos/backend.html#model-inheritance</a> </p>

<p>So, when I add a record for newproduct.uom, a record is automatically created under the model product.uom.  I can assign the values of the corresponding record in product.uom by addressing them in newproduct.uom.   </p>

<p>For my uses, it will be intended as a Parent->child relation, with newproduct.uom being the parent, and the default product.uom being the child.  I chose this method of inheritance to allow quicker creation and modification of related values, as well as a separation of functions (rather than overriding the default methods for default operations).   </p>

<p>In your parent class override unlink. Not sure if I have the correct class name. Delete the child record and then delete the current record.</p>

<pre><code>@api.multi
def unlink(self):
    self.uom_id.unlink()
    return super(new_product_uom, self).unlink()
</code></pre>

python inheritance openerp odoo-9