Skip to content
Snippets Groups Projects
Commit 592d2a29 authored by Jason Van Malder's avatar Jason Van Malder Committed by Nicolas Martinelli
Browse files

[FIX] account_facturx: fix too much restrictive XML bill upload


Issue

    - Install Accounting
    - Upload XML bill (tried with a MX one)

    No decoder was found.

Cause

    The _create_invoice_from_xml method gets decoders from overrides of
    _get_xml_decoders. There is only 2 overrides: Belgium & Italy.

    All others countries are not handled. So, this error blocks
    the user.

Solution

    Log the error instead raising it. (Reproduce V12 behavior)

OPW-2170516

closes odoo/odoo#43393

Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 8703fa33
No related branches found
No related tags found
No related merge requests found
......@@ -299,7 +299,7 @@ class AccountMove(models.Model):
try:
tree = etree.fromstring(content)
except Exception:
raise UserError(_('The xml file is badly formatted : {}').format(attachment.name))
_logger.exception('The xml file is badly formatted : {}'.format(attachment.name))
for xml_type, check_func, decode_func in decoders:
check_res = check_func(tree, attachment.name)
......@@ -313,7 +313,7 @@ class AccountMove(models.Model):
try:
return invoice_ids
except UnboundLocalError:
raise UserError(_('No decoder was found for the xml file: {}. The file is badly formatted, not supported or the decoder is not installed').format(attachment.name))
_logger.exception('No decoder was found for the xml file: {}. The file is badly formatted, not supported or the decoder is not installed'.format(attachment.name))
def _remove_ocr_option(self):
if 'extract_state' in self:
......
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