pyslog 0.1.0.dev6__tar.gz → 0.1.0.dev7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyslog
3
- Version: 0.1.0.dev6
3
+ Version: 0.1.0.dev7
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.dev6"
3
+ version = "0.1.0.dev7"
4
4
  description = "Python e-SLOG library. Simplifies the generation of Slovenian e-SLOG electronic documents."
5
5
  license = "MIT"
6
6
  authors = [
@@ -210,37 +210,39 @@ def generate_eslog_invoice(invoice: Invoice) -> str:
210
210
  ),
211
211
 
212
212
  ],
213
- SG52=[
214
- ESLOG_G_SG52(
215
- S_TAX=ESLOG_S_TAX(
216
- D_5283="7",
217
- C_C241=ESLOG_C_C241(
218
- D_5153="VAT"
219
- ),
220
- C_C243=ESLOG_C_C243(
221
- D_5278="25" ## VAT RATE PERCENTAGE
222
- ),
223
- D_5305="S"
224
- ),
225
- S_MOA=[
226
- ESLOG_S_MOA(
227
- C_C516=ESLOG_C_C516(
228
- D_5025="125",
229
- D_5004="1000.00" # Taxable amount
230
- )
231
- ),
232
- ESLOG_S_MOA(
233
- C_C516=ESLOG_C_C516(
234
- D_5025="124",
235
- D_5004="250.00" # Tax amount
236
- )
237
- ),
238
- ]
239
- )
240
- ],
213
+ SG52=[],
241
214
  )
242
215
  )
243
216
 
217
+ for vat_item in invoice.vat_breakdown:
218
+ eslog_tax = ESLOG_G_SG52(
219
+ S_TAX=ESLOG_S_TAX(
220
+ D_5283="7",
221
+ C_C241=ESLOG_C_C241(
222
+ D_5153="VAT"
223
+ ),
224
+ C_C243=ESLOG_C_C243(
225
+ D_5278=vat_item.vat_category_rate
226
+ ),
227
+ D_5305=vat_item.vat_category_code.value
228
+ ),
229
+ S_MOA=[
230
+ ESLOG_S_MOA(
231
+ C_C516=ESLOG_C_C516(
232
+ D_5025="125",
233
+ D_5004=vat_item.taxable_amount
234
+ )
235
+ ),
236
+ ESLOG_S_MOA(
237
+ C_C516=ESLOG_C_C516(
238
+ D_5025="124",
239
+ D_5004=vat_item.tax_amount
240
+ )
241
+ ),
242
+ ]
243
+ )
244
+ eslog_invoice.M_INVOIC.SG52.append(eslog_tax)
245
+
244
246
  for index, item in enumerate(invoice.items):
245
247
  eslog_item = ESLOG_G_SG26(
246
248
  S_LIN=ESLOG_S_LIN(
@@ -1,4 +1,4 @@
1
- from .invoice import Invoice, Item, BusinessEntity, CEF_VAT_EXEMPTION
1
+ from .invoice import Invoice, Item, BusinessEntity, CEF_VAT_EXEMPTION, VATBreakdown
2
2
  from .enums import (
3
3
  VATPointDateCode,
4
4
  BusinessProcessType,
@@ -15,4 +15,5 @@ __all__ = [
15
15
  "BusinessProcessType",
16
16
  "ItemIdentificationScheme",
17
17
  "VATCategoryCode",
18
+ "VATBreakdown",
18
19
  ]
@@ -11,6 +11,13 @@ class CEF_VAT_EXEMPTION(BaseModel):
11
11
  VAT_EXEMPTION_REASON_CODE: str = Field(description="VAT Exemption Reason (BT-121). Use vode list CEF VATEX — VAT exemption reason code") # TODO Add validation
12
12
  VAT_EXEMPTION_REASON_TEXT: str = Field(description="VAT Exemption Reason (BT-120)")
13
13
 
14
+
15
+ class VATBreakdown(BaseModel):
16
+ taxable_amount: str = Field(description="VAT category taxable amount (BT-116). The sum of all Invoice line net amounts that are subject to a specific VAT category code and VAT category rate, minus all allowances on document level, plus all charges on document level.")
17
+ tax_amount: str = Field(description="VAT category tax amount (BT-117). The total VAT amount for a given VAT category.")
18
+ vat_category_code: VATCategoryCode = Field(description="VAT category code (BT-118). The code that applies to the VAT category.")
19
+ vat_category_rate: str | None = Field(default=None, description="VAT category rate (BT-119). The VAT rate, represented as a percentage that applies for the relevant VAT category.")
20
+
14
21
  class BusinessEntity(BaseModel):
15
22
  identifier: str | None = Field(default=None, description="Buyer identifier (BT-46)")
16
23
  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?
@@ -86,6 +93,7 @@ class Invoice(BaseModel):
86
93
  seller: BusinessEntity = Field(description="Seller")
87
94
  reference_currency_code: str = Field(default="EUR", description="Reference currency code (BT-5). The currency in which all Invoice amounts are given, except for the Total VAT amount in accounting currency. Use code list ISO 4217 — Currency codes") # TODO validation
88
95
  items: list[Item] = Field(description="Items to include in the invoice. Will be automatically numbered starting from 1.")
96
+ vat_breakdown: list[VATBreakdown] = Field(default_factory=list, description="VAT breakdown (BG-23). A group of business terms providing information about VAT breakdown by different categories, rates and exemption reasons.")
89
97
 
90
98
  # Monetary stuff
91
99
  sum_of_invoice_line_net_amount: str = Field(description="Sum of Invoice line net amount (BT-106). The sum of all Invoice line net amounts in the Invoice.")
File without changes