From 54cf8d0ce726585f9a7bdbd087b542fbba1d5993 Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Tue, 14 Jun 2016 14:09:37 +0200 Subject: [PATCH] [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``. --- addons/account_voucher/account_voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index a8528aa8d6e..8116df538c4 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -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