Skip to content

Commit

Permalink
fix(Sales Invoice): add 0-Tax if not other taxes (mandatory)
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Sep 9, 2024
1 parent fb17824 commit e6e1530
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions eu_einvoice/european_e_invoice/custom/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def get_xml(invoice, company, seller_address=None, customer_address=None):
li.settlement.monetary_summation.total_amount = item.amount
doc.trade.items.add(li)

tax_added = False
for tax_row in get_itemised_tax_breakup_data(invoice):
tax_row.pop("item")
taxable_amount = tax_row.pop("taxable_amount")
Expand All @@ -140,8 +141,17 @@ def get_xml(invoice, company, seller_address=None, customer_address=None):
trade_tax.type_code = "VAT"
trade_tax.category_code = "S"
doc.trade.settlement.trade_tax.add(trade_tax)
tax_added = True
break

if not tax_added:
trade_tax = ApplicableTradeTax()
trade_tax.type_code = "VAT"
trade_tax.category_code = "S"
trade_tax.calculated_amount = Decimal("0.00")
trade_tax.rate_applicable_percent = Decimal("0.00")
doc.trade.settlement.trade_tax.add(trade_tax)

doc.trade.settlement.monetary_summation.line_total = invoice.total
doc.trade.settlement.monetary_summation.charge_total = Decimal("0.00")
doc.trade.settlement.monetary_summation.allowance_total = invoice.discount_amount
Expand Down

0 comments on commit e6e1530

Please sign in to comment.