mikrowerk-edi-invoicing 0.3.0__py3-none-any.whl → 0.3.2__py3-none-any.whl

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.
@@ -356,7 +356,8 @@ class DateTimeElement(StringElement):
356
356
  if len(root) != 1:
357
357
  raise TypeError("Date containers should have one child")
358
358
  if root[0].tag != "{%s}%s" % (self._date_time_namespace, "DateTimeString"):
359
- raise TypeError("Tag %s not recognized" % root[0].tag)
359
+ # raise TypeError("Tag %s not recognized" % root[0].tag)
360
+ print("TypeError: Tag %s not recognized" % root[0].tag)
360
361
  self._format = root[0].attrib["format"]
361
362
  if self._format == "102":
362
363
  self._value = datetime.strptime(root[0].text, "%Y%m%d").date()
@@ -38,7 +38,8 @@ class XRechnungEinfachTestCase(unittest.TestCase):
38
38
  ('pdf', 'zugferd/BASIC-WL_Einfach/BASIC-WL_Einfach.pdf'),
39
39
  # ('pdf', 'zugferd/XRECHNUNG_Einfach/XRECHNUNG_Einfach.pdf'), # needs some checks, why test failed
40
40
  # ("pdf", "zugferd/XRECHNUNG_Elektron/XRECHNUNG_Elektron.pdf"), # needs some checks, why test failed
41
- ('pdf', 'odoo_generated/INV_2025_00001.pdf')
41
+ ('pdf', 'odoo_generated/INV_2025_00001.pdf'),
42
+
42
43
  ])
43
44
  def test_x_rechnung_files(self, file_type, file_path):
44
45
  print(f"start testing with file: {file_path}")
@@ -29,11 +29,14 @@ class UblSaxHandler(sax.ContentHandler):
29
29
  self.trade_line_list: [XRechnungTradeLine] = []
30
30
  self.current_trade_tax: XRechnungAppliedTradeTax | None = None
31
31
  self.applicable_trade_taxes: [XRechnungAppliedTradeTax] = []
32
+ self.allowance_line_count = 99900
33
+ self.allowance_line_count_incr = 10
32
34
 
33
35
  def startDocument(self):
34
36
  print("------------------------------ Start ---------------------------------------------------")
35
37
  self.x_rechnung = XRechnung()
36
38
  self.stack = deque()
39
+ self.allowance_line_count = 99900
37
40
 
38
41
  def endDocument(self):
39
42
  self.x_rechnung.name = (
@@ -45,6 +48,7 @@ class UblSaxHandler(sax.ContentHandler):
45
48
  _ns, _tag_name = name
46
49
  self.current_attributes = attrs
47
50
  self.stack.append((_tag_name, attrs))
51
+ _path = '/'.join([tag for tag, _attrs in self.stack])
48
52
  self.content = ""
49
53
  match _tag_name:
50
54
  case "Party":
@@ -59,15 +63,14 @@ class UblSaxHandler(sax.ContentHandler):
59
63
  case "InvoiceLine":
60
64
  self.current_trade_line = XRechnungTradeLine()
61
65
  self.current_trade_tax = None
62
- case "AllowanceCharge":
63
- self.current_trade_line = XRechnungTradeLine()
64
- self.current_trade_tax = None
65
66
  case "TaxSubtotal":
66
67
  self.current_trade_tax = XRechnungAppliedTradeTax()
67
68
  case "ClassifiedTaxCategory":
68
69
  self.current_trade_tax = XRechnungAppliedTradeTax()
69
-
70
- _path = '/'.join([tag for tag, _attrs in self.stack])
70
+ case "AllowanceCharge":
71
+ if _path.endswith('Invoice/AllowanceCharge'):
72
+ self.current_trade_line = XRechnungTradeLine()
73
+ self.current_trade_tax = None
71
74
 
72
75
  if _path.endswith('/AllowanceCharge/TaxCategory'):
73
76
  self.current_trade_tax = XRechnungAppliedTradeTax()
@@ -90,7 +93,7 @@ class UblSaxHandler(sax.ContentHandler):
90
93
  self.handle_payment_means(_path, _tag_name, _content, attrs)
91
94
  if "/InvoiceLine" in _path:
92
95
  self.handle_invoice_line(_path, _tag_name, _content, attrs)
93
- if "/AllowanceCharge" in _path:
96
+ if "Invoice/AllowanceCharge" in _path:
94
97
  self.handle_allowance_charge(_path, _tag_name, _content, attrs)
95
98
  if "/ClassifiedTaxCategory" in _path:
96
99
  self.handle_trade_tax(_path, _tag_name, _content, attrs)
@@ -114,8 +117,10 @@ class UblSaxHandler(sax.ContentHandler):
114
117
  if _path.endswith("Invoice/TaxTotal/TaxSubtotal"):
115
118
  self.applicable_trade_taxes.append(self.current_trade_tax)
116
119
  elif _path.endswith('Invoice/AllowanceCharge'):
117
- self.current_trade_line.trade_tax = self.current_trade_tax
118
- self.current_trade_line.line_id = "99999"
120
+ if hasattr(self.current_trade_line, "trade_tax"):
121
+ self.current_trade_line.trade_tax = self.current_trade_tax
122
+ self.current_trade_line.line_id = f"{self.allowance_line_count}"
123
+ self.allowance_line_count += self.allowance_line_count_incr
119
124
  self.current_trade_line.seller_assigned_id = "AllowanceCharge"
120
125
  self.current_trade_line.total_amount_net = (
121
126
  self.current_trade_line.price_unit * self.current_trade_line.quantity_billed)
@@ -139,6 +144,8 @@ class UblSaxHandler(sax.ContentHandler):
139
144
  self.x_rechnung.doc_id = content
140
145
  case "Invoice/IssueDate":
141
146
  self.x_rechnung.issued_date_time = datetime.fromisoformat(content)
147
+ case "Invoice/Delivery/ActualDeliveryDate":
148
+ self.x_rechnung.delivered_date_time = datetime.fromisoformat(content)
142
149
  case "Invoice/InvoiceTypeCode":
143
150
  self.x_rechnung.doc_type_code = content
144
151
  case "Invoice/DocumentCurrencyCode":
@@ -160,8 +167,8 @@ class UblSaxHandler(sax.ContentHandler):
160
167
  self.x_rechnung.payment_means = self.current_payment_means_list[0]
161
168
  case "Invoice/PaymentTerms/Note":
162
169
  self.x_rechnung.payment_terms = content
163
- case "Invoice/AllowanceCharge/Amount":
164
- self.x_rechnung.allowance_total_amount = Decimal(content)
170
+ # case "Invoice/AllowanceCharge/Amount":
171
+ # self.x_rechnung.allowance_total_amount = Decimal(content)
165
172
  case "Invoice/TaxTotal/TaxAmount":
166
173
  self.x_rechnung.tax_total_amount = [XRechnungCurrency(Decimal(content),
167
174
  attrs.get('currencyID', 'EUR'))]
@@ -244,6 +251,8 @@ class UblSaxHandler(sax.ContentHandler):
244
251
  self.current_trade_line.total_amount_net = float(content)
245
252
  elif path.endswith("/InvoiceLine/Item/Description"):
246
253
  self.current_trade_line.description = content
254
+ elif path.endswith("/InvoiceLine/Note"):
255
+ self.current_trade_line.description += f", {content}" if len(content) > 0 else content
247
256
  elif path.endswith("/InvoiceLine/Item/Name"):
248
257
  self.current_trade_line.name = content
249
258
  elif path.endswith("/InvoiceLine/Item/SellersItemIdentification/ID"):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: mikrowerk_edi_invoicing
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Parser for EDI invoices in CII or UBL format
5
5
  Author: Mikrowerk a Gammadata Division
6
6
  Author-email: info@mikrowerk.com
@@ -28,6 +28,7 @@ Dynamic: classifier
28
28
  Dynamic: description
29
29
  Dynamic: description-content-type
30
30
  Dynamic: license
31
+ Dynamic: license-file
31
32
  Dynamic: requires-dist
32
33
  Dynamic: summary
33
34
 
@@ -11,7 +11,7 @@ edi_invoice_parser/cii_dom_parser/models/accounting.py,sha256=_ngHDoBruw6v5QbLeA
11
11
  edi_invoice_parser/cii_dom_parser/models/container.py,sha256=IRrYWPu2sMcLpSPj63w_Ge-8UpjChspPvP-DSk201X0,2584
12
12
  edi_invoice_parser/cii_dom_parser/models/delivery.py,sha256=Y4_MHzj0St2zup-Z_orq5wlxPncx71BHh3cSHaleAYI,1903
13
13
  edi_invoice_parser/cii_dom_parser/models/document.py,sha256=U3HaJNSk_c3bb9cHjjFuikKGq6ksLxZ71XJySTAAS6E,3091
14
- edi_invoice_parser/cii_dom_parser/models/elements.py,sha256=M6k_76QZY5UjLdRJcUTyJcRJnhNnAY331PHRLoSA7GQ,13549
14
+ edi_invoice_parser/cii_dom_parser/models/elements.py,sha256=X-URXvF_6rKg58fyR8EJAe_Y4s54t8naz5hEDc4OZiU,13619
15
15
  edi_invoice_parser/cii_dom_parser/models/fields.py,sha256=UMwlaFpumCbpaX-iPKsAV3MqZEic4G_sokAQR3dgWhc,10867
16
16
  edi_invoice_parser/cii_dom_parser/models/note.py,sha256=eswaCmiLR_5JVTXVkyLlE_eXzXTEPr_C8dqqyjlHgZU,487
17
17
  edi_invoice_parser/cii_dom_parser/models/party.py,sha256=BF5cpJyw88QGYbsvc_aKxo0XGe4VZNfdKaCMm5wVGGQ,5309
@@ -25,13 +25,13 @@ edi_invoice_parser/model/x_rechnung.py,sha256=2aJRPO5k_X82mLXjJl361mSvf7APSv2eFA
25
25
  edi_invoice_parser/model/xml_abstract_x_rechnung_parser.py,sha256=puxCSC02zIXpfMY9xNLqY-w0aRv0y5ROHmNtmaV16o4,673
26
26
  edi_invoice_parser/tests/__init__.py,sha256=gnkvp4ZsQ0g1L5r6fbyhvFNsSKp0PegdvVeQP_dVQSw,142
27
27
  edi_invoice_parser/tests/test_iban_handling.py,sha256=suRaB9gxbNc2Dc7spjHmQyPBdXva98HF1js85wQWqPM,662
28
- edi_invoice_parser/tests/test_parse_x_rechnung.py,sha256=t4XegzQna0l30B13p3CluIUU5YLBQCSRn-AxHrrl2d8,3558
28
+ edi_invoice_parser/tests/test_parse_x_rechnung.py,sha256=3QuaFhuvcHEr0bAgHPhlY14tYvN-gJEwOY8f9jAo_50,3560
29
29
  edi_invoice_parser/ubl_sax_parser/__init__.py,sha256=P3QhOExirTKDRre-ReGBVv_GFZniEj_kOnWtUSNJGq0,91
30
- edi_invoice_parser/ubl_sax_parser/xml_ubl_sax_parser.py,sha256=wYVnEWvvC_ZJsnDdrnWTvkCi9FZaHuS76VTqKPDpVPg,15589
30
+ edi_invoice_parser/ubl_sax_parser/xml_ubl_sax_parser.py,sha256=p0-gDt5WsPTrs6a_o6y3HLNDNvNZewc4iLirDUZ9YIk,16248
31
31
  edi_invoice_parser/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  edi_invoice_parser/util/file_helper.py,sha256=4gdWbv8L9LSMraLKvGI1Z3NMcuGGy7JB1qFvNaW-yo4,767
33
- mikrowerk_edi_invoicing-0.3.0.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
34
- mikrowerk_edi_invoicing-0.3.0.dist-info/METADATA,sha256=HCXzcD2fucxZmU0oKgflQR1ryEv2hFbeu3mk_SzhqFA,1000
35
- mikrowerk_edi_invoicing-0.3.0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
36
- mikrowerk_edi_invoicing-0.3.0.dist-info/top_level.txt,sha256=OyIJDXDBfR9f0EvTDTmEHdXEFHscjRqX1MxeOeT2VKM,19
37
- mikrowerk_edi_invoicing-0.3.0.dist-info/RECORD,,
33
+ mikrowerk_edi_invoicing-0.3.2.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
34
+ mikrowerk_edi_invoicing-0.3.2.dist-info/METADATA,sha256=QfWKUmLrvyBN72-WBcqRwLXaFcL_9NYZ4JghVWSbVpc,1022
35
+ mikrowerk_edi_invoicing-0.3.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
36
+ mikrowerk_edi_invoicing-0.3.2.dist-info/top_level.txt,sha256=OyIJDXDBfR9f0EvTDTmEHdXEFHscjRqX1MxeOeT2VKM,19
37
+ mikrowerk_edi_invoicing-0.3.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5