Skip to content
Snippets Groups Projects
Commit 54cf8d0c authored by Richard Mathot's avatar Richard Mathot
Browse files

[FIX] account_voucher: allow the web client to catch the warning instead of...

[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``.
parent 0ec664d1
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment