Hello all i try to override unlink method of sale order line. Function called but raise UserError validation not removed.
Odoo default function:
@api.multi
def unlink(self):
if self.filtered(lambda x: x.state in ('sale', 'done')):
raise UserError(_('You can not remove a sale order line.\nDiscard changes and try setting the quantity to 0.'))
return super(SaleOrderLine, self).unlink()
Custom Override function:
@api.multi
def unlink(self):
if self.filtered(lambda x: x.state in ('sale', 'done')):
pass
return super(test, self).unlink()
Thanks in advance.