Files
odoo_source/odoo
Antoine Dupuis 5a09449ddc [FIX] tools: fix filename resolution in XSD imports
With PRs odoo/89145 and enterprise/26393 came new methods for
retrieving XSD files and using them for XML validation.

The new retrieval method expects modules to provide a 'prefix' that
is prepended to the XSD's filename. For example, l10n_cl_edi will
name its XSD files 'l10n_cl_edi.<filename>.xsd'.

However, this messes things up when one XSD file needs to import
another. For example, l10n_cl_edi.DTE_v10.xsd has the statement
'<xs:include schemaLocation="SiiTypes_v10.xsd"/>'

Currently, the filename resolver has no way of knowing that this
should resolve to 'l10n_cl_edi.SiiTypes_v10.xsd', not
'SiiTypes_v10.xsd'.

In addition, the new retrieval method saves the ZIP archives
received over the network under the '<filename.xsd>'. Thus
'SiiTypes_v10.xsd' might actually be a ZIP-encoded file.

So, we need to do something to fix the imports.
Here are two possible solutions:
1. We scrap this 'prefix' stuff and either save the ZIP files under
   a different name, or we just don't save them.
2. Or, we provide a mechanism for indicating a prefix to the filename
   resolver.

Personally, I don't see the point in saving the ZIP files, and this
'prefix' stuff seems pointless. So I prefer solution 1.

But, because I assume there must be a reason to all of that 'prefix'
stuff, here is an implementation of solution 2.

I'd be keen to know the reason, btw.

EDIT:
In addition to the first issue described above, we have the second
issue that some XSD files returned by the Chilean SII are encoded
using ISO-8859-1 encoding (e.g. SiiTypes_v10.xsd). If we leave them
in this encoding, then LXML isn't able to parse them when performing
imports.

closes odoo/odoo#102601

Solution: convert the files to UTF-8 before storing them.
X-original-commit: 75555df56475b457331938453657c1f73d231e33
Related: odoo/enterprise#32482
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-10-07 14:37:14 +02:00
..
2022-08-26 18:41:26 +02:00
…