[FIX] account_voucher: allow the web client to catch the warning instead of returning the whole traceback
Actually, it was a Python ``Warning`` exception that was returned, and not an ``openerp.exceptions.Warning``, that is an alias of ``openerp.exceptions.UserError``.
This commit is contained in:
@@ -144,7 +144,7 @@ class AccountVoucher(models.Model):
|
||||
def unlink(self):
|
||||
for voucher in self:
|
||||
if voucher.state not in ('draft', 'cancel'):
|
||||
raise Warning(_('Cannot delete voucher(s) which are already opened or paid.'))
|
||||
raise UserError(_('Cannot delete voucher(s) which are already opened or paid.'))
|
||||
return super(AccountVoucher, self).unlink()
|
||||
|
||||
@api.multi
|
||||
|
||||
Reference in New Issue
Block a user