update parsed data

This commit is contained in:
Frederik Jaeckel 2025-01-22 18:59:33 +01:00
parent 21edfd9d81
commit 466500f5f5

View file

@ -1,361 +1,361 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of the document-incoming-invoice-xml-module # This file is part of the document-incoming-invoice-xml-module
# from m-ds for Tryton. The COPYRIGHT file at the top level of # from m-ds for Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
from decimal import Decimal from decimal import Decimal
from datetime import date from datetime import date
parsed_data_facturx_en16931 = { parsed_data_facturx_en16931 = {
'buyer_party': { 'buyer_party': {
'city': 'Potsdam', 'city': 'Potsdam',
'name': 'Our Company', 'name': 'Our Company',
'postal_code': '23456', 'postal_code': '23456',
'street': 'Address Line 1\nAddress Line 2'}, 'street': 'Address Line 1\nAddress Line 2'},
'invoice_date': date(2024, 6, 17), 'invoice_date': date(2024, 6, 17),
'invoice_number': 'RE2024.01234', 'invoice_number': 'RE2024.01234',
'lines_data': [{ 'lines_data': [{
'line_no': '1', 'line_no': '1',
'name': 'Name of Product 1', 'name': 'Name of Product 1',
'description': 'Description of Product 1', 'description': 'Description of Product 1',
'unit_net_price': {'amount': Decimal('1350.00')}, 'unit_net_price': {'amount': Decimal('1350.00')},
'quantity': { 'quantity': {
'billed': Decimal('1.0'), 'unit_code': 'KGM'}, 'billed': Decimal('1.0'), 'unit_code': 'KGM'},
'taxes': [{ 'taxes': [{
'type': 'VAT', 'type': 'VAT',
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('19.00')}], 'percent': Decimal('19.00')}],
'total': {'amount': Decimal('1350.00')}, 'total': {'amount': Decimal('1350.00')},
}, { }, {
'line_no': '2', 'line_no': '2',
'line_note': 'Description of Line 2', 'line_note': 'Description of Line 2',
'glob_id': '3', 'glob_id': '3',
'seller_id': '4', 'seller_id': '4',
'buyer_id': '5', 'buyer_id': '5',
'name': 'Name of Product 2', 'name': 'Name of Product 2',
'description': 'Description of Product 2', 'description': 'Description of Product 2',
'trade_country': 'DE', 'trade_country': 'DE',
'attributes': [{ 'attributes': [{
'description': 'Kilogram', 'description': 'Kilogram',
'uom': 'kg'}], 'uom': 'kg'}],
'classification': [{'code': '3c'}], 'classification': [{'code': '3c'}],
'unit_net_price': { 'unit_net_price': {
'amount': Decimal('800.00'), 'amount': Decimal('800.00'),
'basequantity': Decimal('1.0')}, 'basequantity': Decimal('1.0')},
'unit_gross_price': { 'unit_gross_price': {
'amount': Decimal('950.00'), 'amount': Decimal('950.00'),
'basequantity': Decimal('1.0')}, 'basequantity': Decimal('1.0')},
'quantity': { 'quantity': {
'billed': Decimal('1.5'), 'billed': Decimal('1.5'),
'unit_code': 'KGM'}, 'unit_code': 'KGM'},
'taxes': [{ 'taxes': [{
'type': 'VAT', 'type': 'VAT',
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('19.00')}], 'percent': Decimal('19.00')}],
'total': { 'total': {
'amount': Decimal('1200.00')}, 'amount': Decimal('1200.00')},
}, { }, {
'line_no': '3', 'line_no': '3',
'name': 'Name of Product 3', 'name': 'Name of Product 3',
'description': 'Description of Product 3', 'description': 'Description of Product 3',
'unit_net_price': {'amount': Decimal('150.00')}, 'unit_net_price': {'amount': Decimal('150.00')},
'quantity': { 'quantity': {
'billed': Decimal('2.0'), 'billed': Decimal('2.0'),
'unit_code': 'MTR'}, 'unit_code': 'MTR'},
'taxes': [{ 'taxes': [{
'type': 'VAT', 'type': 'VAT',
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('7.00')}], 'percent': Decimal('7.00')}],
'total': {'amount': Decimal('300.00')}}], 'total': {'amount': Decimal('300.00')}}],
'note_list': [{ 'note_list': [{
'Content': 'Description of invoice', 'Content': 'Description of invoice',
'ContentCode': None, 'ContentCode': None,
'SubjectCode': None, 'SubjectCode': None,
}, { }, {
'Content': 'Some notes to the customer.', 'Content': 'Some notes to the customer.',
'ContentCode': None, 'ContentCode': None,
'SubjectCode': None, 'SubjectCode': None,
}, { }, {
'Content': 'Goes to field comment.', 'Content': 'Goes to field comment.',
'ContentCode': None, 'ContentCode': None,
'SubjectCode': '42'}], 'SubjectCode': '42'}],
'payment': { 'payment': {
'bank': [{ 'bank': [{
'info': 'Wire transfer', 'info': 'Wire transfer',
'type': '30', 'type': '30',
'debitor_iban': 'DE02300209000106531065', 'debitor_iban': 'DE02300209000106531065',
'creditor_iban': 'DE02300209000106531065', 'creditor_iban': 'DE02300209000106531065',
'creditor_name': 'mbs', 'creditor_name': 'mbs',
'card_id': 'DE02300209000106531065', 'card_id': 'DE02300209000106531065',
'card_holder_name': 'Card Holder', 'card_holder_name': 'Card Holder',
'institution': 'WELADED1PMB'}], 'institution': 'WELADED1PMB'}],
'currency': 'EUR', 'currency': 'EUR',
'reference': 'RE2024.01234', 'reference': 'RE2024.01234',
'taxes': [{ 'taxes': [{
'amount': Decimal('484.5'), 'amount': Decimal('484.5'),
'type': 'VAT', 'type': 'VAT',
'base': Decimal('2550.0'), 'base': Decimal('2550.0'),
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('19.00'), 'percent': Decimal('19.00'),
}, { }, {
'amount': Decimal('21.0'), 'amount': Decimal('21.0'),
'type': 'VAT', 'type': 'VAT',
'base': Decimal('300.0'), 'base': Decimal('300.0'),
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('7.00')}], 'percent': Decimal('7.00')}],
'terms': [{ 'terms': [{
'description': 'Payment description', 'description': 'Payment description',
'duedate': date(2024, 7, 1), 'duedate': date(2024, 7, 1),
'mandat_id': 'mandat id'}]}, 'mandat_id': 'mandat id'}]},
'seller_party': { 'seller_party': {
'city': 'Berlin', 'city': 'Berlin',
'name': 'Name of the Supplier', 'name': 'Name of the Supplier',
'postal_code': '12345', 'postal_code': '12345',
'street': 'Street of Supplier No 1'}, 'street': 'Street of Supplier No 1'},
'total': { 'total': {
'amount': Decimal('1350.00'), 'amount': Decimal('1350.00'),
'duepayable': Decimal('3355.50'), 'duepayable': Decimal('3355.50'),
'grand': Decimal('3355.50'), 'grand': Decimal('3355.50'),
'taxbase': Decimal('2850.00'), 'taxbase': Decimal('2850.00'),
'taxtotal': Decimal('505.5')}} 'taxtotal': Decimal('505.5')}}
parsed_data_facturx_basic = { parsed_data_facturx_basic = {
'buyer_party': { 'buyer_party': {
'city': 'Potsdam', 'city': 'Potsdam',
'name': 'Our Company', 'name': 'Our Company',
'postal_code': '23456', 'postal_code': '23456',
'street': 'Address Line 1\nAddress Line 2'}, 'street': 'Address Line 1\nAddress Line 2'},
'invoice_date': date(2024, 6, 17), 'invoice_date': date(2024, 6, 17),
'invoice_number': 'RE2024.01234', 'invoice_number': 'RE2024.01234',
'lines_data': [{ 'lines_data': [{
'line_no': '1', 'line_no': '1',
'name': 'Name of Product 1', 'name': 'Name of Product 1',
'unit_net_price': {'amount': Decimal('1350.00')}, 'unit_net_price': {'amount': Decimal('1350.00')},
'quantity': {'billed': Decimal('1.0'), 'unit_code': 'KGM'}, 'quantity': {'billed': Decimal('1.0'), 'unit_code': 'KGM'},
'taxes': [{ 'taxes': [{
'type': 'VAT', 'type': 'VAT',
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('19.00')}], 'percent': Decimal('19.00')}],
'total': {'amount': Decimal('1350.00')}, 'total': {'amount': Decimal('1350.00')},
}, { }, {
'line_no': '2', 'line_no': '2',
'line_note': 'Description of Line 2', 'line_note': 'Description of Line 2',
'glob_id': '3', 'glob_id': '3',
'name': 'Name of Product 2', 'name': 'Name of Product 2',
'unit_net_price': { 'unit_net_price': {
'amount': Decimal('800.00'), 'amount': Decimal('800.00'),
'basequantity': Decimal('1.0')}, 'basequantity': Decimal('1.0')},
'unit_gross_price': { 'unit_gross_price': {
'amount': Decimal('950.00'), 'amount': Decimal('950.00'),
'basequantity': Decimal('1.0')}, 'basequantity': Decimal('1.0')},
'quantity': { 'quantity': {
'billed': Decimal('1.5'), 'billed': Decimal('1.5'),
'unit_code': 'KGM'}, 'unit_code': 'KGM'},
'taxes': [{ 'taxes': [{
'type': 'VAT', 'type': 'VAT',
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('19.00')}], 'percent': Decimal('19.00')}],
'total': {'amount': Decimal('1200.00')}, 'total': {'amount': Decimal('1200.00')},
}, { }, {
'line_no': '3', 'line_no': '3',
'name': 'Name of Product 3', 'name': 'Name of Product 3',
'unit_net_price': {'amount': Decimal('150.00')}, 'unit_net_price': {'amount': Decimal('150.00')},
'quantity': { 'quantity': {
'billed': Decimal('2.0'), 'billed': Decimal('2.0'),
'unit_code': 'MTR'}, 'unit_code': 'MTR'},
'taxes': [{ 'taxes': [{
'type': 'VAT', 'type': 'VAT',
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('7.00')}], 'percent': Decimal('7.00')}],
'total': {'amount': Decimal('300.00')}}], 'total': {'amount': Decimal('300.00')}}],
'note_list': [{ 'note_list': [{
'Content': 'Description of invoice', 'Content': 'Description of invoice',
'ContentCode': None, 'ContentCode': None,
'SubjectCode': None, 'SubjectCode': None,
}, { }, {
'Content': 'Some notes to the customer.', 'Content': 'Some notes to the customer.',
'ContentCode': None, 'ContentCode': None,
'SubjectCode': None, 'SubjectCode': None,
}, { }, {
'Content': 'Goes to field comment.', 'Content': 'Goes to field comment.',
'ContentCode': None, 'ContentCode': None,
'SubjectCode': '42'}], 'SubjectCode': '42'}],
'payment': { 'payment': {
'bank': [{ 'bank': [{
'type': '30', 'type': '30',
'debitor_iban': 'DE02300209000106531065', 'debitor_iban': 'DE02300209000106531065',
'creditor_iban': 'DE02300209000106531065'}], 'creditor_iban': 'DE02300209000106531065'}],
'currency': 'EUR', 'currency': 'EUR',
'reference': 'RE2024.01234', 'reference': 'RE2024.01234',
'taxes': [{ 'taxes': [{
'amount': Decimal('484.5'), 'amount': Decimal('484.5'),
'type': 'VAT', 'type': 'VAT',
'base': Decimal('2550.0'), 'base': Decimal('2550.0'),
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('19.00'), 'percent': Decimal('19.00'),
}, { }, {
'amount': Decimal('21.0'), 'amount': Decimal('21.0'),
'type': 'VAT', 'type': 'VAT',
'base': Decimal('300.0'), 'base': Decimal('300.0'),
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('7.00')}], 'percent': Decimal('7.00')}],
'terms': [{ 'terms': [{
'description': 'Payment description', 'description': 'Payment description',
'duedate': date(2024, 7, 1), 'duedate': date(2024, 7, 1),
'mandat_id': 'mandat id'}]}, 'mandat_id': 'mandat id'}]},
'seller_party': { 'seller_party': {
'city': 'Berlin', 'city': 'Berlin',
'name': 'Name of the Supplier', 'name': 'Name of the Supplier',
'postal_code': '12345', 'postal_code': '12345',
'street': 'Street of Supplier No 1'}, 'street': 'Street of Supplier No 1'},
'total': { 'total': {
'amount': Decimal('1350.00'), 'amount': Decimal('1350.00'),
'duepayable': Decimal('3355.50'), 'duepayable': Decimal('3355.50'),
'grand': Decimal('3355.50'), 'grand': Decimal('3355.50'),
'taxbase': Decimal('2850.00'), 'taxbase': Decimal('2850.00'),
'taxtotal': Decimal('505.5')}} 'taxtotal': Decimal('505.5')}}
parsed_data_facturx_extended = { parsed_data_facturx_extended = {
'invoice_number': 'RE2024.01234', 'invoice_number': 'RE2024.01234',
'invoice_date': date(2024, 6, 17), 'invoice_date': date(2024, 6, 17),
'note_list': [{ 'note_list': [{
'Content': 'Description of invoice', 'Content': 'Description of invoice',
'ContentCode': None, 'ContentCode': None,
'SubjectCode': None, 'SubjectCode': None,
}, { }, {
'Content': 'Some notes to the customer.', 'Content': 'Some notes to the customer.',
'ContentCode': '1', 'ContentCode': '1',
'SubjectCode': None, 'SubjectCode': None,
}, { }, {
'Content': 'Goes to field comment.', 'Content': 'Goes to field comment.',
'ContentCode': '22', 'ContentCode': '22',
'SubjectCode': '42'}], 'SubjectCode': '42'}],
'seller_party': { 'seller_party': {
'name': 'Name of the Supplier', 'name': 'Name of the Supplier',
'postal_code': '12345', 'postal_code': '12345',
'street': 'Street of Supplier No 1', 'street': 'Street of Supplier No 1',
'city': 'Berlin'}, 'city': 'Berlin'},
'buyer_party': { 'buyer_party': {
'name': 'Our Company', 'name': 'Our Company',
'postal_code': '23456', 'postal_code': '23456',
'street': 'Address Line 1\nAddress Line 2', 'street': 'Address Line 1\nAddress Line 2',
'city': 'Potsdam'}, 'city': 'Potsdam'},
'lines_data': [{ 'lines_data': [{
'line_no': '1', 'line_no': '1',
'name': 'Name of Product 1', 'name': 'Name of Product 1',
'description': 'Description of Product 1', 'description': 'Description of Product 1',
'unit_net_price': {'amount': Decimal('1350.00')}, 'unit_net_price': {'amount': Decimal('1350.00')},
'quantity': {'billed': Decimal('1.0'), 'unit_code': 'KGM'}, 'quantity': {'billed': Decimal('1.0'), 'unit_code': 'KGM'},
'taxes': [{ 'taxes': [{
'type': 'VAT', 'type': 'VAT',
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('19.00')}], 'percent': Decimal('19.00')}],
'total': {'amount': Decimal('1350.00')}, 'total': {'amount': Decimal('1350.00')},
}, { }, {
'convert_note': [ 'convert_note': [
'skip: /rsm:CrossIndustryInvoice/' + 'skip: /rsm:CrossIndustryInvoice/' +
'rsm:SupplyChainTradeTransaction/' + 'rsm:SupplyChainTradeTransaction/' +
'ram:IncludedSupplyChainTradeLineItem[2]/' + 'ram:IncludedSupplyChainTradeLineItem[2]/' +
'ram:SpecifiedLineTradeDelivery/' + 'ram:SpecifiedLineTradeDelivery/' +
'ram:ActualDeliverySupplyChainEvent'], 'ram:ActualDeliverySupplyChainEvent'],
'line_no': '2', 'line_no': '2',
'line_note': 'Description of Line 2\n' + 'line_note': 'Description of Line 2\n' +
'Description of Line 2, line 2', 'Description of Line 2, line 2',
'prod_id': '2', 'prod_id': '2',
'glob_id': '3', 'glob_id': '3',
'seller_id': '4', 'seller_id': '4',
'buyer_id': '5', 'buyer_id': '5',
'industy_id': '6', 'industy_id': '6',
'model_id': '7', 'model_id': '7',
'name': 'Name of Product 2', 'name': 'Name of Product 2',
'description': 'Description of Product 2', 'description': 'Description of Product 2',
'lot': 'batch23', 'lot': 'batch23',
'brand_name': 'Brand-Name', 'brand_name': 'Brand-Name',
'model_name': 'Model-Name', 'model_name': 'Model-Name',
'trade_country': 'DE', 'trade_country': 'DE',
'attributes': [{ 'attributes': [{
'code': '123', 'code': '123',
'description': 'Kilogram', 'description': 'Kilogram',
'uom': 'kg', 'uom': 'kg',
'value': Decimal('123.0')}], 'value': Decimal('123.0')}],
'classification': [{ 'classification': [{
'code': '3c', 'name': 'product-class 1'}], 'code': '3c', 'name': 'product-class 1'}],
'serialno': [{'lot': '22', 'serial': '1234'}], 'serialno': [{'lot': '22', 'serial': '1234'}],
'refprod': [{ 'refprod': [{
'id': '1', 'id': '1',
'global_id': '2', 'global_id': '2',
'seller_id': '3', 'seller_id': '3',
'buyer_id': '4', 'buyer_id': '4',
'name': 'ref-prod-1', 'name': 'ref-prod-1',
'description': 'description of ref-prod-1', 'description': 'description of ref-prod-1',
'quantity': Decimal('1.0')}], 'quantity': Decimal('1.0')}],
'unit_net_price': { 'unit_net_price': {
'amount': Decimal('800.00'), 'amount': Decimal('800.00'),
'basequantity': Decimal('1.0')}, 'basequantity': Decimal('1.0')},
'unit_gross_price': { 'unit_gross_price': {
'amount': Decimal('950.00'), 'amount': Decimal('950.00'),
'basequantity': Decimal('1.0')}, 'basequantity': Decimal('1.0')},
'quantity': { 'quantity': {
'billed': Decimal('1.5'), 'billed': Decimal('1.5'),
'unit_code': 'KGM', 'unit_code': 'KGM',
'package': Decimal('1.5')}, 'package': Decimal('1.5')},
'taxes': [{ 'taxes': [{
'type': 'VAT', 'type': 'VAT',
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('19.00')}], 'percent': Decimal('19.00')}],
'total': {'amount': Decimal('1200.00')}, 'total': {'amount': Decimal('1200.00')},
}, { }, {
'line_no': '3', 'line_no': '3',
'name': 'Name of Product 3', 'name': 'Name of Product 3',
'description': 'Description of Product 3', 'description': 'Description of Product 3',
'unit_net_price': {'amount': Decimal('150.00')}, 'unit_net_price': {'amount': Decimal('150.00')},
'quantity': {'billed': Decimal('2.0'), 'unit_code': 'MTR'}, 'quantity': {'billed': Decimal('2.0'), 'unit_code': 'MTR'},
'taxes': [{ 'taxes': [{
'type': 'VAT', 'type': 'VAT',
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('7.00')}], 'percent': Decimal('7.00')}],
'total': {'amount': Decimal('300.00')}, 'total': {'amount': Decimal('300.00')},
}], }],
'payment': { 'payment': {
'reference': 'RE2024.01234', 'reference': 'RE2024.01234',
'currency': 'EUR', 'currency': 'EUR',
'bank': [{ 'bank': [{
'info': 'Wire transfer', 'info': 'Wire transfer',
'type': '30', 'type': '30',
'debitor_iban': 'DE02300209000106531065', 'debitor_iban': 'DE02300209000106531065',
'creditor_iban': 'DE02300209000106531065', 'creditor_iban': 'DE02300209000106531065',
'creditor_name': 'mbs', 'creditor_name': 'mbs',
'card_id': 'DE02300209000106531065', 'card_id': 'DE02300209000106531065',
'card_holder_name': 'Card Holder', 'card_holder_name': 'Card Holder',
'institution': 'WELADED1PMB'}], 'institution': 'WELADED1PMB'}],
'taxes': [{ 'taxes': [{
'amount': Decimal('484.5'), 'amount': Decimal('484.5'),
'type': 'VAT', 'type': 'VAT',
'base': Decimal('2550.0'), 'base': Decimal('2550.0'),
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('19.00'), 'percent': Decimal('19.00'),
}, { }, {
'amount': Decimal('21.0'), 'amount': Decimal('21.0'),
'type': 'VAT', 'type': 'VAT',
'base': Decimal('300.0'), 'base': Decimal('300.0'),
'category_code': 'S', 'category_code': 'S',
'percent': Decimal('7.00')}], 'percent': Decimal('7.00')}],
'terms': [{ 'terms': [{
'description': 'Payment description', 'description': 'Payment description',
'duedate': date(2024, 7, 1), 'duedate': date(2024, 7, 1),
'mandat_id': 'mandat id', 'mandat_id': 'mandat id',
'amount': Decimal('3355.50'), 'amount': Decimal('3355.50'),
'discount_date': date(2024, 7, 2), 'discount_date': date(2024, 7, 2),
'discount_measure': Decimal('10.0'), 'discount_measure': Decimal('10.0'),
'discount_base': Decimal('3355.0'), 'discount_base': Decimal('3355.0'),
'discount_perc': Decimal('2.0'), 'discount_perc': Decimal('2.0'),
'discount_amount': Decimal('70.0')}]}, 'discount_amount': Decimal('70.0')}]},
'total': { 'total': {
'amount': Decimal('1350.00'), 'amount': Decimal('1350.00'),
'taxbase': Decimal('2850.00'), 'taxbase': Decimal('2850.00'),
'taxtotal': Decimal('505.5'), 'taxtotal': Decimal('505.5'),
'grand': Decimal('3355.50'), 'grand': Decimal('3355.50'),
'duepayable': Decimal('3355.50')}} 'duepayable': Decimal('3355.50')}}