feat(e-invoicing): dispatch address (#28084)
This commit is contained in:
parent
b262f48553
commit
0b626816d0
@ -68,7 +68,7 @@
|
||||
|
||||
{%- if einvoice.ShipDtls -%}
|
||||
{%- set shipping = einvoice.ShipDtls -%}
|
||||
<h5 style="margin-bottom: 5px;">Shipping</h5>
|
||||
<h5 style="margin-bottom: 5px;">Shipped From</h5>
|
||||
<p>{{ shipping.Gstin }}</p>
|
||||
<p>{{ shipping.LglNm }}</p>
|
||||
<p>{{ shipping.Addr1 }}</p>
|
||||
@ -86,6 +86,17 @@
|
||||
{%- if buyer.Addr2 -%} <p>{{ buyer.Addr2 }}</p> {% endif %}
|
||||
<p>{{ buyer.Loc }}</p>
|
||||
<p>{{ frappe.db.get_value("Address", doc.customer_address, "gst_state") }} - {{ buyer.Pin }}</p>
|
||||
|
||||
{%- if einvoice.DispDtls -%}
|
||||
{%- set dispatch = einvoice.DispDtls -%}
|
||||
<h5 style="margin-bottom: 5px;">Dispatched From</h5>
|
||||
{%- if dispatch.Gstin -%} <p>{{ dispatch.Gstin }}</p> {% endif %}
|
||||
<p>{{ dispatch.LglNm }}</p>
|
||||
<p>{{ dispatch.Addr1 }}</p>
|
||||
{%- if dispatch.Addr2 -%} <p>{{ dispatch.Addr2 }}</p> {% endif %}
|
||||
<p>{{ dispatch.Loc }}</p>
|
||||
<p>{{ frappe.db.get_value("Address", doc.dispatch_address_name, "gst_state") }} - {{ dispatch.Pin }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div style="overflow-x: auto;">
|
||||
|
@ -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}",
|
||||
|
@ -123,8 +123,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
|
||||
@ -136,10 +136,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
|
||||
@ -431,7 +431,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)
|
||||
@ -443,7 +447,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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user