pyslog 0.1.0.dev10__tar.gz → 0.1.0.dev14__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.
Files changed (18) hide show
  1. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/PKG-INFO +1 -1
  2. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/pyproject.toml +1 -1
  3. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/generator.py +98 -16
  4. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/models/__init__.py +4 -1
  5. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/models/_xml.py +15 -0
  6. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/models/enums/__init__.py +2 -0
  7. pyslog-0.1.0.dev14/src/pyslog/eslog2/models/enums/allowance_type.py +22 -0
  8. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/models/invoice.py +9 -0
  9. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/README.md +0 -0
  10. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/__init__.py +0 -0
  11. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/__init__.py +0 -0
  12. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/models/enums/business_process_type.py +0 -0
  13. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/models/enums/item_identification_scheme.py +0 -0
  14. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/models/enums/payment_means_code.py +0 -0
  15. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/models/enums/vat_category_code.py +0 -0
  16. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/models/enums/vat_point_date_code.py +0 -0
  17. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/schemas/eSLOG20_INVOIC_v200.xsd +0 -0
  18. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev14}/src/pyslog/eslog2/validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyslog
3
- Version: 0.1.0.dev10
3
+ Version: 0.1.0.dev14
4
4
  Summary: Python e-SLOG library. Simplifies the generation of Slovenian e-SLOG electronic documents.
5
5
  Keywords: eslog,eracun,e-racun,e-invoice
6
6
  Author: Gregor Gabrovšek
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyslog"
3
- version = "0.1.0.dev10"
3
+ version = "0.1.0.dev14"
4
4
  description = "Python e-SLOG library. Simplifies the generation of Slovenian e-SLOG electronic documents."
5
5
  license = "MIT"
6
6
  authors = [
@@ -11,10 +11,10 @@ def generate_eslog_invoice(
11
11
  eslog_buyer = ESLOG_G_SG2(
12
12
  S_NAD=ESLOG_S_NAD(
13
13
  D_3035="BY",
14
- # C_C082=ESLOG_C_C082(
15
- # D_3039=invoice.buyer.identifier,
16
- # D_1131=invoice.buyer.identifier_identification_scheme_identifier
17
- # ),
14
+ C_C082=ESLOG_C_C082(
15
+ D_3039=invoice.buyer.identifier,
16
+ D_1131=invoice.buyer.identifier_identification_scheme_identifier
17
+ ) if invoice.buyer.identifier else None,
18
18
  C_C080=ESLOG_C_C080(
19
19
  D_3036=invoice.buyer.name,
20
20
  D_3036_2=invoice.buyer.trading_name
@@ -25,9 +25,56 @@ def generate_eslog_invoice(
25
25
  D_3042_3=invoice.buyer.address_line_3
26
26
  ),
27
27
  D_3207=invoice.buyer.country_code,
28
- )
28
+ ),
29
+ G_SG3=[],
30
+ G_SG5=[]
29
31
  )
30
32
 
33
+ if invoice.buyer.vat_registration_number:
34
+ eslog_buyer.G_SG3.append(
35
+ ESLOG_G_SG3(
36
+ S_RFF=ESLOG_S_RFF(
37
+ C_C506=ESLOG_C_C506(
38
+ D_1153="VA",
39
+ D_1154=invoice.buyer.vat_registration_number
40
+ )
41
+ )
42
+ )
43
+ )
44
+ eslog_buyer.G_SG3.append(
45
+ ESLOG_G_SG3(
46
+ S_RFF=ESLOG_S_RFF(
47
+ C_C506=ESLOG_C_C506(
48
+ D_1153="AHP",
49
+ D_1154=invoice.buyer.vat_registration_number
50
+ )
51
+ )
52
+ )
53
+ )
54
+ if invoice.buyer.maticna:
55
+ eslog_buyer.G_SG3.append(
56
+ ESLOG_G_SG3(
57
+ S_RFF=ESLOG_S_RFF(
58
+ C_C506=ESLOG_C_C506(
59
+ D_1153="0199",
60
+ D_1154=invoice.buyer.maticna
61
+ )
62
+ )
63
+ )
64
+ )
65
+
66
+ if invoice.buyer.contact_person_name:
67
+ eslog_buyer.G_SG5 = [
68
+ ESLOG_G_SG5(
69
+ S_CTA=ESLOG_S_CTA(
70
+ D_3139="BU",
71
+ C_C056=ESLOG_C_C056(
72
+ D_3412=invoice.buyer.contact_person_name
73
+ )
74
+ )
75
+ )
76
+ ]
77
+
31
78
  if invoice.buyer.address_line_2 is not None:
32
79
  eslog_buyer.S_NAD.C_C059.D_3042_2 = invoice.buyer.address_line_2
33
80
  if invoice.buyer.address_line_3 is not None:
@@ -44,10 +91,10 @@ def generate_eslog_invoice(
44
91
  eslog_seller = ESLOG_G_SG2(
45
92
  S_NAD=ESLOG_S_NAD(
46
93
  D_3035="SE",
47
- # C_C082=ESLOG_C_C082(
48
- # D_3039=invoice.seller.identifier,
49
- # D_1131=invoice.seller.identifier_identification_scheme_identifier
50
- # ),
94
+ C_C082=ESLOG_C_C082(
95
+ D_3039=invoice.seller.identifier,
96
+ D_1131=invoice.seller.identifier_identification_scheme_identifier
97
+ ) if invoice.seller.identifier else None,
51
98
  C_C080=ESLOG_C_C080(
52
99
  D_3036=invoice.seller.name,
53
100
  D_3036_2=invoice.seller.trading_name
@@ -68,7 +115,12 @@ def generate_eslog_invoice(
68
115
  D_3433=invoice.seller.bic
69
116
  )
70
117
  ),
71
- G_SG3=[
118
+ G_SG3=[],
119
+ G_SG5=[]
120
+ )
121
+
122
+ if invoice.seller.vat_registration_number:
123
+ eslog_seller.G_SG3.append(
72
124
  ESLOG_G_SG3(
73
125
  S_RFF=ESLOG_S_RFF(
74
126
  C_C506=ESLOG_C_C506(
@@ -76,7 +128,9 @@ def generate_eslog_invoice(
76
128
  D_1154=invoice.seller.vat_registration_number
77
129
  )
78
130
  )
79
- ),
131
+ )
132
+ )
133
+ eslog_seller.G_SG3.append(
80
134
  ESLOG_G_SG3(
81
135
  S_RFF=ESLOG_S_RFF(
82
136
  C_C506=ESLOG_C_C506(
@@ -84,7 +138,10 @@ def generate_eslog_invoice(
84
138
  D_1154=invoice.seller.vat_registration_number
85
139
  )
86
140
  )
87
- ),
141
+ )
142
+ )
143
+ if invoice.seller.maticna:
144
+ eslog_seller.G_SG3.append(
88
145
  ESLOG_G_SG3(
89
146
  S_RFF=ESLOG_S_RFF(
90
147
  C_C506=ESLOG_C_C506(
@@ -92,10 +149,8 @@ def generate_eslog_invoice(
92
149
  D_1154=invoice.seller.maticna
93
150
  )
94
151
  )
95
- ),
96
- ],
97
- G_SG5=[]
98
- )
152
+ )
153
+ )
99
154
 
100
155
  if invoice.seller.contact_person_name:
101
156
  eslog_seller.G_SG5 = [
@@ -353,6 +408,33 @@ def generate_eslog_invoice(
353
408
  )
354
409
  )
355
410
 
411
+ if item.allowance:
412
+ eslog_item.G_SG39.append(
413
+ ESLOG_G_SG39(
414
+ S_ALC=ESLOG_S_ALC(
415
+ D_5463="A",
416
+ C_C552=ESLOG_C_C552(D_5189=item.allowance.allowance_type.value)
417
+ ),
418
+ G_SG41=ESLOG_G_SG41(
419
+ S_PCD=ESLOG_S_PCD(
420
+ C_C501=ESLOG_C_C501(D_5245="1", D_5482=item.allowance.percentage)
421
+ )
422
+ ),
423
+ G_SG42=[
424
+ ESLOG_G_SG42(
425
+ S_MOA=ESLOG_S_MOA(
426
+ C_C516=ESLOG_C_C516(D_5025="204", D_5004=item.allowance.amount)
427
+ )
428
+ ),
429
+ ESLOG_G_SG42(
430
+ S_MOA=ESLOG_S_MOA(
431
+ C_C516=ESLOG_C_C516(D_5025="25", D_5004=item.allowance.base_amount)
432
+ )
433
+ )
434
+ ]
435
+ )
436
+ )
437
+
356
438
  eslog_invoice.M_INVOIC.SG26.append(eslog_item)
357
439
 
358
440
  if invoice.payment_due_date:
@@ -1,9 +1,10 @@
1
- from .invoice import Invoice, Item, BusinessEntity, CEF_VAT_EXEMPTION, VATBreakdown
1
+ from .invoice import Invoice, Item, BusinessEntity, CEF_VAT_EXEMPTION, VATBreakdown, Allowance
2
2
  from .enums import (
3
3
  VATPointDateCode,
4
4
  BusinessProcessType,
5
5
  ItemIdentificationScheme,
6
6
  VATCategoryCode,
7
+ AllowanceType,
7
8
  )
8
9
 
9
10
  __all__ = [
@@ -16,4 +17,6 @@ __all__ = [
16
17
  "ItemIdentificationScheme",
17
18
  "VATCategoryCode",
18
19
  "VATBreakdown",
20
+ "Allowance",
21
+ "AllowanceType",
19
22
  ]
@@ -204,14 +204,29 @@ class ESLOG_G_SG34(BaseXmlModel, tag="G_SG34"):
204
204
  S_TAX: ESLOG_S_TAX = element(tag="S_TAX")
205
205
  S_MOA: list[ESLOG_S_MOA] = element(tag="S_MOA")
206
206
 
207
+ class ESLOG_C_C552(BaseXmlModel, tag="C_C552"):
208
+ D_5189: str = element(name="D_5189")
209
+
207
210
  class ESLOG_S_ALC(BaseXmlModel, tag="S_ALC"):
208
211
  D_5463: str = element(name="D_5463")
212
+ C_C552: ESLOG_C_C552 = element(tag="C_C552")
213
+
214
+ class ESLOG_C_C501(BaseXmlModel, tag="C_C501"):
215
+ D_5245: str = element(name="D_5245")
216
+ D_5482: str = element(name="D_5482")
217
+
218
+ class ESLOG_S_PCD(BaseXmlModel, tag="S_PCD"):
219
+ C_C501: ESLOG_C_C501 = element(tag="C_C501")
220
+
221
+ class ESLOG_G_SG41(BaseXmlModel, tag="G_SG41"):
222
+ S_PCD: ESLOG_S_PCD = element(tag="S_PCD")
209
223
 
210
224
  class ESLOG_G_SG42(BaseXmlModel, tag="G_SG42"):
211
225
  S_MOA: ESLOG_S_MOA = element(tag="S_MOA")
212
226
 
213
227
  class ESLOG_G_SG39(BaseXmlModel, tag="G_SG39"):
214
228
  S_ALC: ESLOG_S_ALC = element(tag="S_ALC")
229
+ G_SG41: ESLOG_G_SG41 | None = element(tag="G_SG41", default=None)
215
230
  G_SG42: list[ESLOG_G_SG42] = element(tag="G_SG42")
216
231
 
217
232
  class ESLOG_G_SG26(BaseXmlModel, tag="G_SG26", skip_empty=True):
@@ -3,6 +3,7 @@ from .business_process_type import BusinessProcessType
3
3
  from .item_identification_scheme import ItemIdentificationScheme
4
4
  from .vat_category_code import VATCategoryCode
5
5
  from .payment_means_code import PaymentMeansCode
6
+ from .allowance_type import AllowanceType
6
7
 
7
8
  __all__ = [
8
9
  "VATPointDateCode",
@@ -10,4 +11,5 @@ __all__ = [
10
11
  "ItemIdentificationScheme",
11
12
  "VATCategoryCode",
12
13
  "PaymentMeansCode",
14
+ "AllowanceType",
13
15
  ]
@@ -0,0 +1,22 @@
1
+ from enum import Enum
2
+
3
+ class AllowanceType(Enum):
4
+ SPECIAL_REBATE = "100"
5
+ FIXED_LONG_TERM = "102"
6
+ TEMPORARY = "103"
7
+ STANDARD = "104"
8
+ YEARLY_TURNOVER = "105"
9
+ BONUS_AHEAD_OF_SCHEDULE = "41"
10
+ OTHER_BONUS = "42"
11
+ MANUFACTURERS_CONSUMER_DISCOUNT = "60"
12
+ MILITARY_STATUS = "62"
13
+ WORK_ACCIDENT = "63"
14
+ SPECIAL_AGREEMENT = "64"
15
+ PRODUCTION_ERROR_DISCOUNT = "65"
16
+ NEW_OUTLET_DISCOUNT = "66"
17
+ SAMPLE_DISCOUNT = "67"
18
+ END_OF_RANGE_DISCOUNT = "68"
19
+ INCOTERM_DISCOUNT = "70"
20
+ POS_THRESHOLD_ALLOWANCE = "71"
21
+ MATERIAL_SURCHARGE_DEDUCTION = "88"
22
+ DISCOUNT = "95"
@@ -5,6 +5,7 @@ from .enums import (
5
5
  ItemIdentificationScheme,
6
6
  VATCategoryCode,
7
7
  PaymentMeansCode,
8
+ AllowanceType,
8
9
  )
9
10
 
10
11
 
@@ -19,6 +20,13 @@ class VATBreakdown(BaseModel):
19
20
  vat_category_code: VATCategoryCode = Field(description="VAT category code (BT-118). The code that applies to the VAT category.")
20
21
  vat_category_rate: str = Field(default=None, description="VAT category rate (BT-119). The VAT rate, represented as a percentage that applies for the relevant VAT category.")
21
22
 
23
+
24
+ class Allowance(BaseModel):
25
+ allowance_type: AllowanceType = Field(description="Allowance reason code (BT-140). Use code list UNTDID 51890")
26
+ percentage: str = Field(description="Allowance percentage (BT-138)")
27
+ amount: str = Field(description="Allowance amount (BT-136)")
28
+ base_amount: str = Field(description="Allowance base amount (BT-137)")
29
+
22
30
  class BusinessEntity(BaseModel):
23
31
  identifier: str | None = Field(default=None, description="Buyer identifier (BT-46)")
24
32
  identifier_identification_scheme_identifier: str | None = Field(default="0088", description="Buyer identifier identification scheme identifier (BT-46-1). The identification scheme identifier of the Buyer identifier. Use code list ISO/IEC 6523 — Identifier scheme code") # Todo validation?
@@ -54,6 +62,7 @@ class Item(BaseModel):
54
62
  item_gross_price: str | None = Field(default=None, description="Item gross price (BT-148). The unit price, exclusive of VAT; before subtracting item price discount.")
55
63
  vat_rate: str = Field(description="Invoiced item VAT rate (BT-152). The VAR rate, represented as percentage that applies to the invoiced item.")
56
64
  vat_category_code: VATCategoryCode = Field(description="Invoiced item VAT category code (BT-151). The VAT category code for the invoiced item")
65
+ allowance: Allowance | None = Field(default=None, description="Invoiced item allowance (BG-27)")
57
66
 
58
67
 
59
68
 
File without changes