From ed98a580f46496418f5dd49e8ec8f0815546b596 Mon Sep 17 00:00:00 2001 From: Sanket Brahmbhatt Date: Thu, 12 Oct 2023 14:46:26 +0530 Subject: [PATCH] [FIX] base_import: handle exception while import image in url form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An error will be generated when a user tries to import or upload a file into the invoice module and the file is attached to an image via a URL form but the image is invalid or cannot be found. step to reproduce- - install the `Accounting`. - open Accounting > Vendors Menu > Products. - import file (image url must be invalid or not found ) - the error will be generated. At the time of solving the conflicts of FW mistakenly changed the "ImportValidationError" to "ValueError". Due to these changes, the error is shown in the log. FW - https://github.com/odoo/odoo/pull/137596 sentry-4538772256 closes odoo/odoo#144011 X-original-commit: 581c0c69f368f08bcf9803942027b172b8bc2694 Signed-off-by: Rémy Voet (ryv) --- addons/base_import/models/base_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_import/models/base_import.py b/addons/base_import/models/base_import.py index d4017e97ee3..2a303047e13 100644 --- a/addons/base_import/models/base_import.py +++ b/addons/base_import/models/base_import.py @@ -1271,7 +1271,7 @@ class Import(models.TransientModel): return base64.b64encode(content) except Exception as e: _logger.warning(e, exc_info=True) - raise ValueError(_("Could not retrieve URL: %(url)s [%(field_name)s: L%(line_number)d]: %(error)s") % { + raise ImportValidationError(_("Could not retrieve URL: %(url)s [%(field_name)s: L%(line_number)d]: %(error)s") % { 'url': url, 'field_name': field, 'line_number': line_number + 1,