diff --git a/base_location_nuts/__openerp__.py b/base_location_nuts/__openerp__.py index f0ff5ffb1..e1f7cb650 100644 --- a/base_location_nuts/__openerp__.py +++ b/base_location_nuts/__openerp__.py @@ -35,6 +35,9 @@ 'wizard/nuts_import_view.xml', 'security/ir.model.access.csv', ], + 'images': [ + 'images/new_fields.png', + ], 'author': 'Antiun IngenierĂ­a S.L., ' 'Odoo Community Association (OCA)', 'website': 'http://www.antiun.com', diff --git a/base_location_nuts/images/new_fields.png b/base_location_nuts/images/new_fields.png new file mode 100644 index 000000000..24f235bf5 Binary files /dev/null and b/base_location_nuts/images/new_fields.png differ diff --git a/base_location_nuts/wizard/nuts_import.py b/base_location_nuts/wizard/nuts_import.py index 31cc49548..2073bceff 100644 --- a/base_location_nuts/wizard/nuts_import.py +++ b/base_location_nuts/wizard/nuts_import.py @@ -4,15 +4,13 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, api, _ -from openerp.exceptions import Warning +from openerp.exceptions import Warning as UserError import requests import re import logging from lxml import etree from collections import OrderedDict -from pprint import pformat - logger = logging.getLogger(__name__) @@ -93,7 +91,7 @@ class NutsImport(models.TransientModel): else: logger.debug("xpath = '%s', not found" % field_xpath) if field_required and not value: - raise Warning( + raise UserError( _('Value not found for mandatory field %s' % k)) item[k] = value return item @@ -114,11 +112,11 @@ class NutsImport(models.TransientModel): try: res_request = requests.get(url) except Exception, e: - raise Warning( + raise UserError( _('Got an error when trying to download the file: %s.') % str(e)) if res_request.status_code != requests.codes.ok: - raise Warning( + raise UserError( _('Got an error %d when trying to download the file %s.') % (res_request.status_code, url)) logger.info('Download successfully %d bytes' % @@ -127,7 +125,7 @@ class NutsImport(models.TransientModel): pattern = re.compile(r'^.*<\?xml', re.DOTALL) content_fixed = re.sub(pattern, '