fix: vat18 should be item amount subject to VAT, make objectName optional
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a7e6d697c5
commit
10be61958c
|
|
@ -179,13 +179,6 @@ def validate_invoice_for_sending(doc):
|
|||
"message": f"Customer '{doc.customer}' does not have a TIN (tax_id). Please update customer details."
|
||||
}
|
||||
|
||||
# Check customer object name
|
||||
if not doc.customer_object_name:
|
||||
return {
|
||||
"valid": False,
|
||||
"message": "Customer's legal company name is required. Please fill the 'Customer Object Name' field in the Sales Invoice."
|
||||
}
|
||||
|
||||
# Validate items
|
||||
if not doc.items:
|
||||
return {
|
||||
|
|
@ -478,7 +471,7 @@ def build_invoice_payload(doc, serial_number):
|
|||
receiver = {
|
||||
"name": etaxes_customer_name,
|
||||
"tin": customer.tax_id,
|
||||
"objectName": doc.customer_object_name
|
||||
"objectName": doc.customer_object_name or ""
|
||||
}
|
||||
|
||||
# Build items array
|
||||
|
|
@ -487,8 +480,8 @@ def build_invoice_payload(doc, serial_number):
|
|||
item_master = frappe.get_doc("Item", item.item_code)
|
||||
|
||||
# Map VAT fields to E-Taxes format
|
||||
# vat18 = pure VAT tax amount (vat_amount), NOT total with VAT (vat_18_percent_with_amount)
|
||||
vat18 = item.vat_amount if hasattr(item, 'vat_amount') and item.vat_amount else None
|
||||
# vat18 = the amount subject to 18% VAT (i.e. item.amount), not the tax itself
|
||||
vat18 = item.amount if hasattr(item, 'vat_18_percent_with_amount') and item.vat_18_percent_with_amount else None
|
||||
vat0 = item.vat_0_percent_with_amount if hasattr(item, 'vat_0_percent_with_amount') and item.vat_0_percent_with_amount else None
|
||||
vat_free = item.vat_free_amount if hasattr(item, 'vat_free_amount') and item.vat_free_amount else None
|
||||
exempt = item.amount_without_vat if hasattr(item, 'amount_without_vat') and item.amount_without_vat else None
|
||||
|
|
|
|||
Loading…
Reference in New Issue