diff --git a/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html b/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html index 7643eca7635d..e65804930951 100644 --- a/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html +++ b/erpnext/accounts/print_format/gst_e_invoice/gst_e_invoice.html @@ -68,7 +68,7 @@
Seller
{%- if einvoice.ShipDtls -%} {%- set shipping = einvoice.ShipDtls -%} -
Shipping
+
Shipped From

{{ shipping.Gstin }}

{{ shipping.LglNm }}

{{ shipping.Addr1 }}

@@ -86,6 +86,17 @@
Buyer
{%- if buyer.Addr2 -%}

{{ buyer.Addr2 }}

{% endif %}

{{ buyer.Loc }}

{{ frappe.db.get_value("Address", doc.customer_address, "gst_state") }} - {{ buyer.Pin }}

+ + {%- if einvoice.DispDtls -%} + {%- set dispatch = einvoice.DispDtls -%} +
Dispatched From
+ {%- if dispatch.Gstin -%}

{{ dispatch.Gstin }}

{% endif %} +

{{ dispatch.LglNm }}

+

{{ dispatch.Addr1 }}

+ {%- if dispatch.Addr2 -%}

{{ dispatch.Addr2 }}

{% endif %} +

{{ dispatch.Loc }}

+

{{ frappe.db.get_value("Address", doc.dispatch_address_name, "gst_state") }} - {{ dispatch.Pin }}

+ {% endif %}
diff --git a/erpnext/regional/india/e_invoice/einv_template.json b/erpnext/regional/india/e_invoice/einv_template.json index 60f490d61669..c2a28f20494c 100644 --- a/erpnext/regional/india/e_invoice/einv_template.json +++ b/erpnext/regional/india/e_invoice/einv_template.json @@ -38,7 +38,7 @@ "Pos": "{buyer_details.place_of_supply}" }}, "DispDtls": {{ - "Nm": "{dispatch_details.company_name}", + "Nm": "{dispatch_details.legal_name}", "Addr1": "{dispatch_details.address_line1}", "Addr2": "{dispatch_details.address_line2}", "Loc": "{dispatch_details.location}", diff --git a/erpnext/regional/india/e_invoice/utils.py b/erpnext/regional/india/e_invoice/utils.py index f7aa65776b02..cd2c8a26b1c7 100644 --- a/erpnext/regional/india/e_invoice/utils.py +++ b/erpnext/regional/india/e_invoice/utils.py @@ -138,8 +138,8 @@ def get_doc_details(invoice): invoice_date=invoice_date )) -def validate_address_fields(address, is_shipping_address): - if ((not address.gstin and not is_shipping_address) +def validate_address_fields(address, skip_gstin_validation): + if ((not address.gstin and not skip_gstin_validation) or not address.city or not address.pincode or not address.address_title @@ -151,10 +151,10 @@ def validate_address_fields(address, is_shipping_address): title=_('Missing Address Fields') ) -def get_party_details(address_name, is_shipping_address=False): +def get_party_details(address_name, skip_gstin_validation=False): addr = frappe.get_doc('Address', address_name) - validate_address_fields(addr, is_shipping_address) + validate_address_fields(addr, skip_gstin_validation) if addr.gst_state_number == 97: # according to einvoice standard @@ -443,7 +443,11 @@ def make_einvoice(invoice): if invoice.gst_category == 'Overseas': shipping_details = get_overseas_address_details(invoice.shipping_address_name) else: - shipping_details = get_party_details(invoice.shipping_address_name, is_shipping_address=True) + shipping_details = get_party_details(invoice.shipping_address_name, skip_gstin_validation=True) + + dispatch_details = frappe._dict({}) + if invoice.dispatch_address_name: + dispatch_details = get_party_details(invoice.dispatch_address_name, skip_gstin_validation=True) if invoice.is_pos and invoice.base_paid_amount: payment_details = get_payment_details(invoice) @@ -455,7 +459,7 @@ def make_einvoice(invoice): eway_bill_details = get_eway_bill_details(invoice) # not yet implemented - dispatch_details = period_details = export_details = frappe._dict({}) + period_details = export_details = frappe._dict({}) einvoice = schema.format( transaction_details=transaction_details, doc_details=doc_details, dispatch_details=dispatch_details,