pyslog 0.1.0.dev10__tar.gz → 0.1.0.dev11__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.dev11}/PKG-INFO +1 -1
  2. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/pyproject.toml +1 -1
  3. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/generator.py +27 -0
  4. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/models/__init__.py +4 -1
  5. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/models/_xml.py +15 -0
  6. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/models/enums/__init__.py +2 -0
  7. pyslog-0.1.0.dev11/src/pyslog/eslog2/models/enums/allowance_type.py +22 -0
  8. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/models/invoice.py +9 -0
  9. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/README.md +0 -0
  10. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/__init__.py +0 -0
  11. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/__init__.py +0 -0
  12. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/models/enums/business_process_type.py +0 -0
  13. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/models/enums/item_identification_scheme.py +0 -0
  14. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/models/enums/payment_means_code.py +0 -0
  15. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/models/enums/vat_category_code.py +0 -0
  16. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/models/enums/vat_point_date_code.py +0 -0
  17. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/src/pyslog/eslog2/schemas/eSLOG20_INVOIC_v200.xsd +0 -0
  18. {pyslog-0.1.0.dev10 → pyslog-0.1.0.dev11}/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.dev11
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.dev11"
4
4
  description = "Python e-SLOG library. Simplifies the generation of Slovenian e-SLOG electronic documents."
5
5
  license = "MIT"
6
6
  authors = [
@@ -353,6 +353,33 @@ def generate_eslog_invoice(
353
353
  )
354
354
  )
355
355
 
356
+ if item.allowance:
357
+ eslog_item.G_SG39.append(
358
+ ESLOG_G_SG39(
359
+ S_ALC=ESLOG_S_ALC(
360
+ D_5463="A",
361
+ C_C552=ESLOG_C_C552(D_5189=item.allowance.allowance_type.value)
362
+ ),
363
+ G_SG41=ESLOG_G_SG41(
364
+ S_PCD=ESLOG_S_PCD(
365
+ C_C501=ESLOG_C_C501(D_5245="1", D_5482=item.allowance.percentage)
366
+ )
367
+ ),
368
+ G_SG42=[
369
+ ESLOG_G_SG42(
370
+ S_MOA=ESLOG_S_MOA(
371
+ C_C516=ESLOG_C_C516(D_5025="204", D_5004=item.allowance.amount)
372
+ )
373
+ ),
374
+ ESLOG_G_SG42(
375
+ S_MOA=ESLOG_S_MOA(
376
+ C_C516=ESLOG_C_C516(D_5025="25", D_5004=item.allowance.base_amount)
377
+ )
378
+ )
379
+ ]
380
+ )
381
+ )
382
+
356
383
  eslog_invoice.M_INVOIC.SG26.append(eslog_item)
357
384
 
358
385
  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