mikrowerk-edi-invoicing 0.1.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1}/PKG-INFO +1 -1
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/model/x_rechnung.py +1 -1
- mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser/tests/__init__.py +4 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/tests/test_parse_x_rechnung.py +3 -3
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/x_mapper/xml_ubl_sax_parser.py +31 -2
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1}/mikrowerk_edi_invoicing.egg-info/PKG-INFO +1 -1
- mikrowerk_edi_invoicing-0.2.1/mikrowerk_edi_invoicing.egg-info/SOURCES.txt +36 -0
- mikrowerk_edi_invoicing-0.2.1/mikrowerk_edi_invoicing.egg-info/top_level.txt +1 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1}/setup.py +2 -2
- mikrowerk_edi_invoicing-0.1.0/mikrowerk_edi_invoicing.egg-info/SOURCES.txt +0 -34
- mikrowerk_edi_invoicing-0.1.0/mikrowerk_edi_invoicing.egg-info/top_level.txt +0 -4
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1}/LICENSE +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1}/README.md +0 -0
- {mikrowerk_edi_invoicing-0.1.0/tests → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/__init__.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/model/__init__.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/tests/test_iban_handling.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/util/__init__.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/util/file_helper.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/x_mapper/__init__.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/x_mapper/cross_industry_invoice_mapper.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/x_mapper/drafthorse_elements_helper.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/x_mapper/xml_abstract_x_rechnung_parser.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/x_mapper/xml_cii_dom_parser.py +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1}/mikrowerk_edi_invoicing.egg-info/dependency_links.txt +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1}/mikrowerk_edi_invoicing.egg-info/requires.txt +0 -0
- {mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1}/setup.cfg +0 -0
|
@@ -178,7 +178,7 @@ class XRechnung:
|
|
|
178
178
|
def map_tradeline_to_dict(cls, x_trade_line: XRechnungTradeLine) -> dict:
|
|
179
179
|
_dict = asdict(x_trade_line)
|
|
180
180
|
_dict.update(
|
|
181
|
-
{'trade_tax': asdict(x_trade_line.trade_tax),
|
|
181
|
+
{'trade_tax': asdict(x_trade_line.trade_tax) if x_trade_line.trade_tax is not None else None,
|
|
182
182
|
'price_unit': float(x_trade_line.price_unit),
|
|
183
183
|
'quantity_billed': float(x_trade_line.quantity_billed),
|
|
184
184
|
'total_amount_net': float(x_trade_line.total_amount_net),
|
|
@@ -4,9 +4,9 @@ from parameterized import parameterized
|
|
|
4
4
|
|
|
5
5
|
from facturx import get_facturx_xml_from_pdf
|
|
6
6
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
7
|
+
from . import get_checked_file_path
|
|
8
|
+
from . import parse_and_map_x_rechnung
|
|
9
|
+
from . import XRechnung
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class XRechnungEinfachTestCase(unittest.TestCase):
|
|
@@ -8,8 +8,8 @@ import xml.sax as sax
|
|
|
8
8
|
from decimal import Decimal
|
|
9
9
|
|
|
10
10
|
from ..model.x_rechnung import (XRechnung, XRechnungTradeParty, XRechnungTradeAddress, XRechnungTradeContact,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
XRechnungPaymentMeans, XRechnungBankAccount, XRechnungCurrency, XRechnungTradeLine,
|
|
12
|
+
XRechnungAppliedTradeTax)
|
|
13
13
|
from .xml_abstract_x_rechnung_parser import XMLAbstractXRechnungParser
|
|
14
14
|
|
|
15
15
|
|
|
@@ -58,6 +58,10 @@ class UblSaxHandler(sax.ContentHandler):
|
|
|
58
58
|
self.current_payment_means.payee_account = XRechnungBankAccount()
|
|
59
59
|
case "InvoiceLine":
|
|
60
60
|
self.current_trade_line = XRechnungTradeLine()
|
|
61
|
+
self.current_trade_tax = None
|
|
62
|
+
case "AllowanceCharge":
|
|
63
|
+
self.current_trade_line = XRechnungTradeLine()
|
|
64
|
+
self.current_trade_tax = None
|
|
61
65
|
case "TaxSubtotal":
|
|
62
66
|
self.current_trade_tax = XRechnungAppliedTradeTax()
|
|
63
67
|
case "ClassifiedTaxCategory":
|
|
@@ -65,6 +69,9 @@ class UblSaxHandler(sax.ContentHandler):
|
|
|
65
69
|
|
|
66
70
|
_path = '/'.join([tag for tag, _attrs in self.stack])
|
|
67
71
|
|
|
72
|
+
if _path.endswith('/AllowanceCharge/TaxCategory'):
|
|
73
|
+
self.current_trade_tax = XRechnungAppliedTradeTax()
|
|
74
|
+
|
|
68
75
|
print(f">>>>>>>>>>>>>>> start: {_ns} {_tag_name} >>>>>>>>>>>>>>>>")
|
|
69
76
|
print(_path)
|
|
70
77
|
for k, v in attrs.items():
|
|
@@ -83,10 +90,14 @@ class UblSaxHandler(sax.ContentHandler):
|
|
|
83
90
|
self.handle_payment_means(_path, _tag_name, _content, attrs)
|
|
84
91
|
if "/InvoiceLine" in _path:
|
|
85
92
|
self.handle_invoice_line(_path, _tag_name, _content, attrs)
|
|
93
|
+
if "/AllowanceCharge" in _path:
|
|
94
|
+
self.handle_allowance_charge(_path, _tag_name, _content, attrs)
|
|
86
95
|
if "/ClassifiedTaxCategory" in _path:
|
|
87
96
|
self.handle_trade_tax(_path, _tag_name, _content, attrs)
|
|
88
97
|
if "/TaxTotal/TaxSubtotal" in _path:
|
|
89
98
|
self.handle_trade_tax(_path, _tag_name, _content, attrs)
|
|
99
|
+
if "/AllowanceCharge/TaxCategory" in _path:
|
|
100
|
+
self.handle_trade_tax(_path, _tag_name, _content, attrs)
|
|
90
101
|
|
|
91
102
|
# collect results when closing a main tag
|
|
92
103
|
match _tag_name:
|
|
@@ -102,6 +113,13 @@ class UblSaxHandler(sax.ContentHandler):
|
|
|
102
113
|
|
|
103
114
|
if _path.endswith("Invoice/TaxTotal/TaxSubtotal"):
|
|
104
115
|
self.applicable_trade_taxes.append(self.current_trade_tax)
|
|
116
|
+
elif _path.endswith('Invoice/AllowanceCharge'):
|
|
117
|
+
self.current_trade_line.trade_tax = self.current_trade_tax
|
|
118
|
+
self.current_trade_line.line_id = "99999"
|
|
119
|
+
self.current_trade_line.seller_assigned_id = "AllowanceCharge"
|
|
120
|
+
self.current_trade_line.total_amount_net = (
|
|
121
|
+
self.current_trade_line.price_unit * self.current_trade_line.quantity_billed)
|
|
122
|
+
self.trade_line_list.append(self.current_trade_line)
|
|
105
123
|
|
|
106
124
|
# invoice top level properties
|
|
107
125
|
self.handle_invoice(_path, _tag_name, _content, attrs)
|
|
@@ -239,6 +257,17 @@ class UblSaxHandler(sax.ContentHandler):
|
|
|
239
257
|
elif path.endswith("/InvoiceLine/Price/PriceAmount"):
|
|
240
258
|
self.current_trade_line.price_unit = float(content)
|
|
241
259
|
|
|
260
|
+
def handle_allowance_charge(self, path: str, tag: str, content: str, attr=None):
|
|
261
|
+
if path.endswith("/AllowanceCharge/AllowanceChargeReason"):
|
|
262
|
+
self.current_trade_line.name = content
|
|
263
|
+
elif path.endswith("/AllowanceCharge/Amount"):
|
|
264
|
+
self.current_trade_line.price_unit = float(content)
|
|
265
|
+
elif path.endswith("/AllowanceCharge/ChargeIndicator"):
|
|
266
|
+
if content.lower() == "true":
|
|
267
|
+
self.current_trade_line.quantity_billed = 1.0
|
|
268
|
+
else:
|
|
269
|
+
self.current_trade_line.quantity_billed = -1.0
|
|
270
|
+
|
|
242
271
|
def handle_trade_tax(self, path: str, tag: str, content: str, attr=None):
|
|
243
272
|
if path.endswith("/ClassifiedTaxCategory/ID") or path.endswith("/TaxCategory/ID"):
|
|
244
273
|
self.current_trade_tax.category_code = content
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
./edi_invoice_parser/__init__.py
|
|
5
|
+
./edi_invoice_parser/model/__init__.py
|
|
6
|
+
./edi_invoice_parser/model/x_rechnung.py
|
|
7
|
+
./edi_invoice_parser/tests/__init__.py
|
|
8
|
+
./edi_invoice_parser/tests/test_iban_handling.py
|
|
9
|
+
./edi_invoice_parser/tests/test_parse_x_rechnung.py
|
|
10
|
+
./edi_invoice_parser/util/__init__.py
|
|
11
|
+
./edi_invoice_parser/util/file_helper.py
|
|
12
|
+
./edi_invoice_parser/x_mapper/__init__.py
|
|
13
|
+
./edi_invoice_parser/x_mapper/cross_industry_invoice_mapper.py
|
|
14
|
+
./edi_invoice_parser/x_mapper/drafthorse_elements_helper.py
|
|
15
|
+
./edi_invoice_parser/x_mapper/xml_abstract_x_rechnung_parser.py
|
|
16
|
+
./edi_invoice_parser/x_mapper/xml_cii_dom_parser.py
|
|
17
|
+
./edi_invoice_parser/x_mapper/xml_ubl_sax_parser.py
|
|
18
|
+
edi_invoice_parser/__init__.py
|
|
19
|
+
edi_invoice_parser/model/__init__.py
|
|
20
|
+
edi_invoice_parser/model/x_rechnung.py
|
|
21
|
+
edi_invoice_parser/tests/__init__.py
|
|
22
|
+
edi_invoice_parser/tests/test_iban_handling.py
|
|
23
|
+
edi_invoice_parser/tests/test_parse_x_rechnung.py
|
|
24
|
+
edi_invoice_parser/util/__init__.py
|
|
25
|
+
edi_invoice_parser/util/file_helper.py
|
|
26
|
+
edi_invoice_parser/x_mapper/__init__.py
|
|
27
|
+
edi_invoice_parser/x_mapper/cross_industry_invoice_mapper.py
|
|
28
|
+
edi_invoice_parser/x_mapper/drafthorse_elements_helper.py
|
|
29
|
+
edi_invoice_parser/x_mapper/xml_abstract_x_rechnung_parser.py
|
|
30
|
+
edi_invoice_parser/x_mapper/xml_cii_dom_parser.py
|
|
31
|
+
edi_invoice_parser/x_mapper/xml_ubl_sax_parser.py
|
|
32
|
+
mikrowerk_edi_invoicing.egg-info/PKG-INFO
|
|
33
|
+
mikrowerk_edi_invoicing.egg-info/SOURCES.txt
|
|
34
|
+
mikrowerk_edi_invoicing.egg-info/dependency_links.txt
|
|
35
|
+
mikrowerk_edi_invoicing.egg-info/requires.txt
|
|
36
|
+
mikrowerk_edi_invoicing.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
edi_invoice_parser
|
|
@@ -16,7 +16,7 @@ setuptools.setup(
|
|
|
16
16
|
name="mikrowerk_edi_invoicing",
|
|
17
17
|
|
|
18
18
|
# version of the module
|
|
19
|
-
version="0.1
|
|
19
|
+
version="0.2.1",
|
|
20
20
|
|
|
21
21
|
# Name of Author
|
|
22
22
|
author="Mikrowerk a Gammadata Division",
|
|
@@ -33,7 +33,7 @@ setuptools.setup(
|
|
|
33
33
|
|
|
34
34
|
# Any link to reach this module, ***if*** you have any webpage or github profile
|
|
35
35
|
# url="https://github.com/username/",
|
|
36
|
-
packages=setuptools.find_packages(),
|
|
36
|
+
packages=setuptools.find_packages(exclude=["tests"]),
|
|
37
37
|
|
|
38
38
|
package_dir={"": "."},
|
|
39
39
|
include_package_data=True,
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
setup.py
|
|
4
|
-
./model/__init__.py
|
|
5
|
-
./model/x_rechnung.py
|
|
6
|
-
./tests/__init__.py
|
|
7
|
-
./tests/test_iban_handling.py
|
|
8
|
-
./tests/test_parse_x_rechnung.py
|
|
9
|
-
./util/__init__.py
|
|
10
|
-
./util/file_helper.py
|
|
11
|
-
./x_mapper/__init__.py
|
|
12
|
-
./x_mapper/cross_industry_invoice_mapper.py
|
|
13
|
-
./x_mapper/drafthorse_elements_helper.py
|
|
14
|
-
./x_mapper/xml_abstract_x_rechnung_parser.py
|
|
15
|
-
./x_mapper/xml_cii_dom_parser.py
|
|
16
|
-
./x_mapper/xml_ubl_sax_parser.py
|
|
17
|
-
mikrowerk_edi_invoicing.egg-info/PKG-INFO
|
|
18
|
-
mikrowerk_edi_invoicing.egg-info/SOURCES.txt
|
|
19
|
-
mikrowerk_edi_invoicing.egg-info/dependency_links.txt
|
|
20
|
-
mikrowerk_edi_invoicing.egg-info/requires.txt
|
|
21
|
-
mikrowerk_edi_invoicing.egg-info/top_level.txt
|
|
22
|
-
model/__init__.py
|
|
23
|
-
model/x_rechnung.py
|
|
24
|
-
tests/__init__.py
|
|
25
|
-
tests/test_iban_handling.py
|
|
26
|
-
tests/test_parse_x_rechnung.py
|
|
27
|
-
util/__init__.py
|
|
28
|
-
util/file_helper.py
|
|
29
|
-
x_mapper/__init__.py
|
|
30
|
-
x_mapper/cross_industry_invoice_mapper.py
|
|
31
|
-
x_mapper/drafthorse_elements_helper.py
|
|
32
|
-
x_mapper/xml_abstract_x_rechnung_parser.py
|
|
33
|
-
x_mapper/xml_cii_dom_parser.py
|
|
34
|
-
x_mapper/xml_ubl_sax_parser.py
|
|
File without changes
|
|
File without changes
|
{mikrowerk_edi_invoicing-0.1.0/tests → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/__init__.py
RENAMED
|
File without changes
|
{mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/model/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{mikrowerk_edi_invoicing-0.1.0 → mikrowerk_edi_invoicing-0.2.1/edi_invoice_parser}/util/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|