Bernd Wurst commited on 2025-05-04 07:46:22
Zeige 1 geänderte Dateien mit 9 Einfügungen und 0 Löschungen.
| ... | ... |
@@ -19,6 +19,7 @@ from drafthorse.models.accounting import ApplicableTradeTax |
| 19 | 19 |
from drafthorse.models.tradelines import LineItem |
| 20 | 20 |
from .InvoiceObjects import InvoiceTable, InvoiceText, RECHNUNG, GUTSCHRIFT, KORREKTUR, \ |
| 21 | 21 |
VAT_REGULAR, VAT_KLEINUNTERNEHMER, VAT_INNERGEM, PAYMENT_UEBERWEISUNG, PAYMENT_LASTSCHRIFT, UNITS |
| 22 |
+from drafthorse.models.accounting import TradeAllowanceCharge |
|
| 22 | 23 |
from drafthorse.models.party import TaxRegistration, URIUniversalCommunication |
| 23 | 24 |
from drafthorse.models.payment import PaymentTerms |
| 24 | 25 |
from drafthorse.models.note import IncludedNote |
| ... | ... |
@@ -220,6 +221,14 @@ def InvoiceToXML(invoice): |
| 220 | 221 |
li.settlement.trade_tax.rate_applicable_percent = Decimal(f"{el['vat'] * 100:.2f}")
|
| 221 | 222 |
|
| 222 | 223 |
nettopreis = round(el['net_price'], 2) |
| 224 |
+ if nettopreis < 0: |
|
| 225 |
+ li.agreement.net.amount = Decimal('0.00')
|
|
| 226 |
+ allowance = TradeAllowanceCharge() |
|
| 227 |
+ allowance.indicator = False |
|
| 228 |
+ allowance.actual_amount = round(abs(nettopreis * el['count']), 2) |
|
| 229 |
+ allowance.reason_code = '104' # Code für "Standard discount" |
|
| 230 |
+ li.settlement.allowance_charge.add(allowance) |
|
| 231 |
+ else: |
|
| 223 | 232 |
li.agreement.net.amount = nettopreis |
| 224 | 233 |
|
| 225 | 234 |
nettosumme = round(el['net_price'] * el['count'], 2) |
| 226 | 235 |