From 95aca437fcd788e15b36b61c6a9c8fd8816c4213 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Thu, 23 Jan 2025 14:39:37 +0100 Subject: [PATCH 1/6] compatibility to Tryton 6.8 --- README.rst | 8 +++++--- setup.py | 4 ++-- tryton.cfg | 2 +- versiondep.txt | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index c95392e..dd70a27 100644 --- a/README.rst +++ b/README.rst @@ -9,12 +9,14 @@ pip install mds-document-incoming-invoice-xml Requires ======== -- Tryton 7.0 +- Tryton 6.8 Changes ======= -*7.0.0 - 19.12.2024* +*6.8.1 - 19.12.2024* -- init +- compatibility to Tryton 6.8 +- import of Factur-X (Basic, EN16931, Extended), CrossIndustryInvoice-D22 +- with/without PDF-Container diff --git a/setup.py b/setup.py index 06fd569..9c57c51 100644 --- a/setup.py +++ b/setup.py @@ -34,8 +34,8 @@ with open(path.join(here, 'versiondep.txt'), encoding='utf-8') as f: modversion[l2[0]] = {'min': l2[1], 'max': l2[2], 'prefix': l2[3]} # tryton-version -major_version = 7 -minor_version = 0 +major_version = 6 +minor_version = 8 requires = ['pypdf', 'factur-x', 'lxml'] for dep in info.get('depends', []): diff --git a/tryton.cfg b/tryton.cfg index db07b00..a0b8902 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=7.0.0 +version=6.8.0 depends: document_incoming_invoice edocument_unece diff --git a/versiondep.txt b/versiondep.txt index e69de29..0715553 100644 --- a/versiondep.txt +++ b/versiondep.txt @@ -0,0 +1 @@ +document_incoming_invoice;6.8.0;6.8.999;mds From 5575408be7cf8a6e2c669976442af509fb4497ce Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Thu, 23 Jan 2025 14:40:36 +0100 Subject: [PATCH 2/6] Version 6.8.1 --- tryton.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton.cfg b/tryton.cfg index a0b8902..3c24db3 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=6.8.0 +version=6.8.1 depends: document_incoming_invoice edocument_unece From 446be5bb058d0858cb474ef98ef6288dc5a0596a Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Fri, 24 Jan 2025 09:27:16 +0100 Subject: [PATCH 3/6] Version 6.8.2 --- README.rst | 4 ++++ tryton.cfg | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index dd70a27..1c40b64 100644 --- a/README.rst +++ b/README.rst @@ -15,6 +15,10 @@ Requires Changes ======= +*6.8.2 - 24.01.2025* + +- fix: limit content-check to supplier-invoices + *6.8.1 - 19.12.2024* - compatibility to Tryton 6.8 diff --git a/tryton.cfg b/tryton.cfg index 3c24db3..91267d3 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=6.8.1 +version=6.8.2 depends: document_incoming_invoice edocument_unece From 148f237084a255da5fd0c4457214a43d45a8ed22 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Mon, 27 Jan 2025 13:11:58 +0100 Subject: [PATCH 4/6] Version 6.8.3 --- README.rst | 4 ++++ tryton.cfg | 2 +- versiondep.txt | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 1c40b64..3f43e60 100644 --- a/README.rst +++ b/README.rst @@ -15,6 +15,10 @@ Requires Changes ======= +*6.8.3 - 27.01.2025* + +- filter product-categories in configuration + *6.8.2 - 24.01.2025* - fix: limit content-check to supplier-invoices diff --git a/tryton.cfg b/tryton.cfg index 1cc9aab..c4252be 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=6.8.2 +version=6.8.3 depends: document_incoming_invoice edocument_unece diff --git a/versiondep.txt b/versiondep.txt index 0715553..1b34c4b 100644 --- a/versiondep.txt +++ b/versiondep.txt @@ -1 +1,2 @@ document_incoming_invoice;6.8.0;6.8.999;mds +sale_point_invoice;6.8.15;6.8.999;mds From d52774a77e4fe5c7eb8fd71fda118348013c2aea Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Wed, 29 Jan 2025 10:50:13 +0100 Subject: [PATCH 5/6] round incoming unit_price and quantity to match digits of fields --- document.py | 14 +++++++++----- tests/parsed_data.py | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/document.py b/document.py index 3445df8..39b1f00 100644 --- a/document.py +++ b/document.py @@ -20,6 +20,7 @@ from trytond.i18n import gettext from trytond.model import fields from trytond.pyson import Eval from trytond.protocols.jsonrpc import JSONEncoder +from trytond.modules.product import round_price xml_types = [ @@ -719,12 +720,15 @@ class Incoming(metaclass=PoolMeta): if units: xml_uom = units[0] + unitprice = line_data.get('unit_net_price', {}).pop('amount', None) line = Line( invoice=invoice, type='line', unit=xml_uom, - quantity=line_data.get('quantity', {}).pop('billed', None), - unit_price=line_data.get('unit_net_price', {}).pop('amount', None)) + quantity=xml_uom.round( + line_data.get('quantity', {}).pop('billed', None)), + unit_price=round_price(unitprice) + if unitprice is not None else Decimal('0.0')) line_no = line_data.pop('line_no', None) # description @@ -963,9 +967,9 @@ class Incoming(metaclass=PoolMeta): result['quantity'] = self._readxml_read_listdata( xmldata, xpath_line, [ 'ram:SpecifiedLineTradeDelivery'], [ - ('ram:BilledQuantity', 'billed', Decimal), - ('ram:ChargeFreeQuantity', 'chargefree', Decimal), - ('ram:PackageQuantity', 'package', Decimal), + ('ram:BilledQuantity', 'billed', float), + ('ram:ChargeFreeQuantity', 'chargefree', float), + ('ram:PackageQuantity', 'package', float), ])[0] result['quantity']['unit_code'] = self._readxml_getattrib( xmldata, xpath_quantity + ['ram:BilledQuantity'], 'unitCode') diff --git a/tests/parsed_data.py b/tests/parsed_data.py index 0e5315f..351052d 100644 --- a/tests/parsed_data.py +++ b/tests/parsed_data.py @@ -23,7 +23,7 @@ parsed_data_ci_invoice = { 'total': {'amount': Decimal('1350.00')}, 'line_no': '1', 'quantity': { - 'billed': Decimal('1.0'), + 'billed': 1.0, 'unit_code': 'KGM'}, 'unit_net_price': {'amount': Decimal('1350.00')}, }, { @@ -34,7 +34,7 @@ parsed_data_ci_invoice = { 'total': {'amount': Decimal('1200.00')}, 'line_no': '2', 'quantity': { - 'billed': Decimal('1.5'), + 'billed': 1.5, 'unit_code': 'KGM'}, 'unit_net_price': {'amount': Decimal('800.00')}, }, { @@ -42,7 +42,7 @@ parsed_data_ci_invoice = { 'total': {'amount': Decimal('300.00')}, 'line_no': '3', 'quantity': { - 'billed': Decimal('2.0'), + 'billed': 2.0, 'unit_code': 'MTR'}, 'unit_net_price': {'amount': Decimal('150.00')}}], 'note_list': [{ @@ -101,7 +101,7 @@ parsed_data_facturx_en16931 = { 'description': 'Description of Product 1', 'unit_net_price': {'amount': Decimal('1350.00')}, 'quantity': { - 'billed': Decimal('1.0'), 'unit_code': 'KGM'}, + 'billed': 1.0, 'unit_code': 'KGM'}, 'taxes': [{ 'type': 'VAT', 'category_code': 'S', @@ -127,7 +127,7 @@ parsed_data_facturx_en16931 = { 'amount': Decimal('950.00'), 'basequantity': Decimal('1.0')}, 'quantity': { - 'billed': Decimal('1.5'), + 'billed': 1.5, 'unit_code': 'KGM'}, 'taxes': [{ 'type': 'VAT', @@ -141,7 +141,7 @@ parsed_data_facturx_en16931 = { 'description': 'Description of Product 3', 'unit_net_price': {'amount': Decimal('150.00')}, 'quantity': { - 'billed': Decimal('2.0'), + 'billed': 2.0, 'unit_code': 'MTR'}, 'taxes': [{ 'type': 'VAT', @@ -213,7 +213,7 @@ parsed_data_facturx_basic = { 'line_no': '1', 'name': 'Name of Product 1', 'unit_net_price': {'amount': Decimal('1350.00')}, - 'quantity': {'billed': Decimal('1.0'), 'unit_code': 'KGM'}, + 'quantity': {'billed': 1.0, 'unit_code': 'KGM'}, 'taxes': [{ 'type': 'VAT', 'category_code': 'S', @@ -231,7 +231,7 @@ parsed_data_facturx_basic = { 'amount': Decimal('950.00'), 'basequantity': Decimal('1.0')}, 'quantity': { - 'billed': Decimal('1.5'), + 'billed': 1.5, 'unit_code': 'KGM'}, 'taxes': [{ 'type': 'VAT', @@ -243,7 +243,7 @@ parsed_data_facturx_basic = { 'name': 'Name of Product 3', 'unit_net_price': {'amount': Decimal('150.00')}, 'quantity': { - 'billed': Decimal('2.0'), + 'billed': 2.0, 'unit_code': 'MTR'}, 'taxes': [{ 'type': 'VAT', @@ -328,7 +328,7 @@ parsed_data_facturx_extended = { 'name': 'Name of Product 1', 'description': 'Description of Product 1', 'unit_net_price': {'amount': Decimal('1350.00')}, - 'quantity': {'billed': Decimal('1.0'), 'unit_code': 'KGM'}, + 'quantity': {'billed': 1.0, 'unit_code': 'KGM'}, 'taxes': [{ 'type': 'VAT', 'category_code': 'S', @@ -379,7 +379,7 @@ parsed_data_facturx_extended = { 'amount': Decimal('950.00'), 'basequantity': Decimal('1.0')}, 'quantity': { - 'billed': Decimal('1.5'), + 'billed': 1.5, 'unit_code': 'KGM', 'package': Decimal('1.5')}, 'taxes': [{ @@ -392,7 +392,7 @@ parsed_data_facturx_extended = { 'name': 'Name of Product 3', 'description': 'Description of Product 3', 'unit_net_price': {'amount': Decimal('150.00')}, - 'quantity': {'billed': Decimal('2.0'), 'unit_code': 'MTR'}, + 'quantity': {'billed': 2.0, 'unit_code': 'MTR'}, 'taxes': [{ 'type': 'VAT', 'category_code': 'S', From 01616c6c4bb8c89d93aaacfab8a48e28017c5103 Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Fri, 2 May 2025 14:34:43 +0200 Subject: [PATCH 6/6] Update copyright --- COPYRIGHT | 5 ++--- setup.py | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index 38bee72..8a21255 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,6 +1,5 @@ -Copyright (C) 2015-2025 Cédric Krier. -Copyright (C) 2015-2025 B2CK SPRL. -Copyright (C) 2021-2025 martin-data services. +Copyright (C) 2024-2025 martin-data services. +Copyright (C) 2025 Mathias Behrle This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/setup.py b/setup.py index 06fd569..559ba9e 100644 --- a/setup.py +++ b/setup.py @@ -85,6 +85,8 @@ setup( 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], keywords='tryton account invoice xrechnung edocument incoming',