import cross-industry-invoice-d22

This commit is contained in:
Frederik Jaeckel 2025-01-23 11:43:11 +01:00
parent 83bb948e78
commit 48385f9250
3 changed files with 261 additions and 7 deletions

View file

@ -34,7 +34,7 @@ xml_types = [
(['xsd', 'Factur-X_1.07.2_EXTENDED', 'Factur-X_1.07.2_EXTENDED.xsd'],
'Factur-X extended', 'facturx_extended'),
(['xsd', 'CII D22B XSD', 'CrossIndustryInvoice_100pD22B.xsd'],
'CrossIndustryInvoice D22', ''),
'CrossIndustryInvoice D22', 'crossindustryinvoice_d22'),
(['xsd', 'os-UBL-2.1', 'xsd/maindoc', 'UBL-Invoice-2.1.xsd'],
'XRechnung - Invoice', ''),
(['xsd', 'os-UBL-2.1', 'xsd', 'maindoc', 'UBL-CreditNote-2.1.xsd'],
@ -409,6 +409,11 @@ class Incoming(metaclass=PoolMeta):
invoice.on_change_lines()
return invoice
def _readxml_crossindustryinvoice_d22(self, xmltree):
""" read cross industry invoice d22
"""
self._readxml_facturx_extended(xmltree, xmode='ciid22')
def _readxml_facturx_minimal(self, xmltree):
""" add missing values to conversion-result
@ -436,7 +441,7 @@ class Incoming(metaclass=PoolMeta):
"""
self._readxml_facturx_extended(xmltree)
def _readxml_facturx_extended(self, xmltree):
def _readxml_facturx_extended(self, xmltree, xmode=None):
""" read factur-x extended
"""
Configuration = Pool().get('document.incoming.configuration')
@ -470,11 +475,12 @@ class Incoming(metaclass=PoolMeta):
date_path = xpath_exchg_doc + [
'ram:IssueDateTime', 'udt:DateTimeString']
date_format = self._readxml_getattrib(xmltree, date_path, 'format')
if date_format != '102':
raise UserError(gettext(
'document_incoming_invoice_xml.msg_convert_error',
msg='invalid date-format: %(code)s (expect: 102)' % {
'code': str(date_format)}))
if xmode not in ['ciid22']:
if date_format != '102':
raise UserError(gettext(
'document_incoming_invoice_xml.msg_convert_error',
msg='invalid date-format: %(code)s (expect: 102)' % {
'code': str(date_format)}))
p_data['invoice_date'] = self._readxml_convertdate(
self._readxml_getvalue(xmltree, date_path))