lib-cl-sii-python
lib-cl-sii-python copied to clipboard
data.ref: update XML schemas of "factura electrónica"
Changelog:
-
SiiTypes_v10.xsd
- Replaces CRLF line endings with LF.
-
root
: A new simple typeDec14_4-0Type
is added for non-negative decimals (admits 0) -
TipoTransCOMPRA
: The base type is changed and adds a restriction for the minimum and the maximum value (1 - 7) -
TipoTransVENTA
: Adds restriction for the minimum and maximum value (1 - 4)
-
DTE_v10.xsd
- Replaces CRLF line endings with LF.
-
IdDoc
: Adds the elementTipoFactEsp
-
Receptor.Extranjero
: Adds the elementTipoDocID
-
IndServicio
: Adds a new item to the enumeration -
MntExeOtrMnda
: Type changed toDec14_4-0Type
-
MntTotOtrMnda
: Type changed toDec14_4-0Type
Source of the previous version of the file: repository/project "LibreDTE": https://github.com/LibreDTE/libredte-lib/blob/c12f8845/schemas/SiiTypes_v10.xsd
Source of the new version of the file: cl-sii-extraoficial/archivos-oficiales@c89dec5
@yaselc please add the referenced files (both the old and the new one) to https://github.com/cl-sii-extraoficial/archivos-oficiales beforehand, so we can reference them here in a more stable way than we did previously
https://github.com/cl-sii-extraoficial/archivos-oficiales/issues/11
please add the referenced files (both the old and the new one) to https://github.com/cl-sii-extraoficial/archivos-oficiales beforehand,
@glarrain should we use separate directories or separate commits will be enough?
I'd like the following:
- the files that are updated and/or referenced here please upload them to https://github.com/cl-sii-extraoficial/archivos-oficiales
- update this PR (description, commits and code) with references to that repo, with permalinks (shorted if you want, but make sure the commit ID is included)
I'd like the following:
- the files that are updated and/or referenced here please upload them to https://github.com/cl-sii-extraoficial/archivos-oficiales
- update this PR (description, commits and code) with references to that repo, with permalinks (shorted if you want, but make sure the commit ID is included)
@glarrain yes, I realized that the changes had to be added in cl-sii-extraoficial/archivos-oficiales, but I had doubts about the structure. Here a single directory is used for the XML schemas, but in cl-sii-extraoficial/archivos-oficiales, they are separated by domain. Could you please, take a look at https://github.com/cl-sii-extraoficial/archivos-oficiales/pull/12, and when those changes are approved then I update this PR.
Codecov Report
Merging #200 (88911a8) into develop (d9e4eab) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## develop #200 +/- ##
========================================
Coverage 81.07% 81.07%
========================================
Files 32 32
Lines 2536 2536
Branches 380 380
========================================
Hits 2056 2056
Misses 306 306
Partials 174 174
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update d9e4eab...88911a8. Read the comment docs.
@glarrain @jtrh this PR is ready for your review 🙏
@yaselc since this change might have a significant impact perhaps some validation with lots of real XML files would be appropriate. Also, I'm thinking that perhaps we should record somehow along the validation the "version" of XML schemas set. What do you think @jtrh ?
Also, I'm thinking that perhaps we should record somehow along the validation the "version" of XML schemas set. What do you think @jtrh ?
@glarrain: What do you think about adding the package version (from setup.py
) to the error message of the exception raised in cl_sii.libs.xml_utils.validate_xml_doc
? Caveat: The information would only be guaranteed to be correct for Git-tagged releases, as any changes to the XSD files would not be reflected in the package version until the next release; however, the advantage of this idea is that it should be straightforward to implement, and does not require metadata such as the commit IDs or the checksums of the XSD files.
Also, I'm thinking that perhaps we should record somehow along the validation the "version" of XML schemas set. What do you think @jtrh ?
@glarrain: What do you think about adding the package version (from
setup.py
) to the error message of the exception raised incl_sii.libs.xml_utils.validate_xml_doc
?
I like the concept. However, I think it is simpler to use the value cl_sii.__version__
.
Source of the old (current) DTE_v10.xsd
and SiiTypes_v10.xsd
is LibreDTE.
commit 8b51350cf0590ab7ba4a1390676f6b307395b950
Author: Germán Larraín <[email protected]>
Date: Thu Jan 17 16:41:46 2019 -0300
data.ref: update XML schemas of "factura electrónica"
Update schemas from an unofficial source since the files available on
SII's website are outdated with respect to the regulations (and even
to the documentation PDFs published alongside).
Source: repository/project "LibreDTE" at
https://github.com/LibreDTE/libredte-lib
Specific source per file:
- 'schema_dte/DTE_v10.xsd':
https://github.com/LibreDTE/libredte-lib/blob/c12f8845/schemas/DTE_v10.xsd
- 'schema_dte/EnvioDTE_v10.xsd':
https://github.com/LibreDTE/libredte-lib/blob/c12f8845/schemas/EnvioDTE_v10.xsd
- 'schema_dte/SiiTypes_v10.xsd':
https://github.com/LibreDTE/libredte-lib/blob/c12f8845/schemas/SiiTypes_v10.xsd
- 'schema_iecv/LceCal_v10.xsd'
https://github.com/LibreDTE/libredte-lib/blob/c12f8845/schemas/LceCal_v10.xsd
- 'schema_iecv/LceCoCertif_v10.xsd'
I love good commit messages, and it pays back to invest time in crafting them ;)
@jtrh @yaselc @yanosky I've thinking about this and I have a sense that having a single "version" of the XML schemas at a point in time might not be convenient. For example, some documents might validate correctly in an older version and not the latest.
What if we have a directory for each "version" (it could be a sequential number/letter arbitrarily defined by us, taking care of not conveying the idea that comparing version numbers does not make sense; they are labels/IDs)? It would be up to the caller to decide which version to use ("explicit is better than implicit").
I think that could solve a number of issues that we've been discussing (and other we have not, yet).
For example, some documents might validate correctly in an older version and not the latest.
I think it's the other way around, these schemas are supposed to maintain backward compatibility, preventing old invoices from becoming out of date. The problem is to validate new invoices with old versions of the schema. I think using the last version should be always the recommendation. It could still happen, but this could be solved using a completely different version of the entire library because most likely even the models need to change, not just the schemas.
I think it's the other way around, these schemas are supposed to maintain backward compatibility
I think that SII loves to break the rules and we can not trust them in that regard. Also, it is perfectly possible (and makes sense) for them to introduce a schema for validating all invoices issued from a certain date onwards, and with which older documents wouldn't validate.
CC: @jtrobles-cdd
@ycouce-cdd status?
@ycouce-cdd status?
@glarrain-cdd After your last comments, I began to iterate on a new PR to version the XML schemas on https://github.com/fyntex/lib-cl-sii-python/pull/211 and put this on hold until it is decided which way we will go.
[...] put this on hold until it is decided which way we will go.
@ycouce-cdd I'll remove myself as a reviewer of this PR while it's on hold. Feel free to add me back if anything changes.