I am trying to overwrite the unlink method of the sale.order model.
class SaleOrderExtension(models.Model):
_inherit = "sale.order"
# ...
def unlink(self):
# ...
return super(SaleOrderExtension, self).unlink()
It seems to work, but the check:
if order.state not in ('draft', 'cancel'):
in the original sales model is still executed!
https://github.com/odoo/odoo/blob/14.0/addons/sale/models/sale.py#LC362
How can I remove this check?
Thank you!