OCA / l10n-italy

Odoo Italian localization
https://www.odoo-italia.org
GNU Affero General Public License v3.0
154 stars 306 forks source link

[IMP] l10n_it_fatturapa_out: errore più verboso nel caso di presenza di caratteri non validi #4390

Open tafaRU opened 1 month ago

tafaRU commented 1 month ago

Risolve https://github.com/OCA/l10n-italy/issues/4389 per 14.0.

tafaRU commented 1 month ago

I test falliscono a causa del modulo account_edi_ubl_cii che viene installato per una catena di auto_install che parte da accout_edi. Riporto l'errore per esteso:

2024-10-01 13:45:11,833 600 ERROR odoo odoo.addons.l10n_it_fatturapa_out.tests.test_fatturapa_xml_validation: ERROR: TestFatturaPAXMLValidation.test_invalid_char_fail
Traceback (most recent call last):
  File "/__w/l10n-italy/l10n-italy/l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py", line 952, in test_invalid_char_fail
    invoice._post()
  File "/__w/l10n-italy/l10n-italy/l10n_it_ricevute_bancarie/models/account.py", line 150, in _post
    return super()._post(soft=soft)
  File "/__w/l10n-italy/l10n-italy/l10n_it_declaration_of_intent/models/account_move.py", line 81, in _post
    posted = super()._post(soft)
  File "/__w/l10n-italy/l10n-italy/l10n_it_account_stamp/models/account_move.py", line 154, in _post
    res = super(AccountMove, self)._post(soft=soft)
  File "/opt/odoo/addons/sale/models/account_invoice.py", line 75, in _post
    posted = super()._post(soft)
  File "/opt/odoo/addons/purchase_stock/models/account_invoice.py", line 173, in _post
    return super()._post(soft)
  File "/opt/odoo/addons/stock_account/models/account_move.py", line 53, in _post
    posted = super()._post(soft)
  File "/opt/odoo-venv/lib/python3.6/site-packages/odoo/addons/account_invoice_inter_company/models/account_move.py", line 72, in _post
    res = super()._post(soft=soft)
  File "/opt/odoo/addons/account_edi/models/account_move.py", line 361, in _post
    posted.edi_document_ids._process_documents_no_web_services()
  File "/opt/odoo/addons/account_edi/models/account_edi_document.py", line 249, in _process_documents_no_web_services
    self._process_jobs(self._convert_to_old_jobs_format(jobs))
  File "/opt/odoo/addons/account_edi/models/account_edi_document.py", line 145, in _process_jobs
    self._process_job(documents, doc_type)
  File "/opt/odoo/addons/account_edi/models/account_edi_document.py", line 231, in _process_job
    edi_result = edi_format._post_invoice_edi(documents.move_id, test_mode=test_mode)
  File "/opt/odoo/addons/account_edi_ubl_cii/models/account_edi_format.py", line 112, in _post_invoice_edi
    xml_content, errors = builder._export_invoice(invoice)
  File "/opt/odoo/addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py", line 242, in _export_invoice
    return etree.tostring(cleanup_xml_node(xml_content), xml_declaration=True, encoding='UTF-8'), set(errors)
  File "/opt/odoo/odoo/tools/xml_utils.py", line 107, in cleanup_xml_node
    xml_node = etree.fromstring(xml_node)
  File "src/lxml/lxml.etree.pyx", line 3213, in lxml.etree.fromstring (src/lxml/lxml.etree.c:79003)
  File "src/lxml/parser.pxi", line 1848, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:118334)
  File "src/lxml/parser.pxi", line 1736, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:117014)
  File "src/lxml/parser.pxi", line 1102, in lxml.etree._BaseParser._parseDoc (src/lxml/lxml.etree.c:111258)
  File "src/lxml/parser.pxi", line 595, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:105102)
  File "src/lxml/parser.pxi", line 706, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:106810)
  File "src/lxml/parser.pxi", line 635, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:105664)
  File "<string>", line 40
lxml.etree.XMLSyntaxError: PCDATA invalid Char value 2, line 40, column 35