[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:
Richard Mathot
2016-06-14 14:12:37 +02:00
parent 0ec664d1a7
commit 54cf8d0ce7
+1 -1
View File
@@ -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