mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 03:01:22 +00:00
fix(regional): remove shipping address GSTIN validation for e-invoice (#25153)
This commit is contained in:
@@ -87,10 +87,10 @@ def get_doc_details(invoice):
|
|||||||
invoice_date=invoice_date
|
invoice_date=invoice_date
|
||||||
))
|
))
|
||||||
|
|
||||||
def get_party_details(address_name):
|
def get_party_details(address_name, company_address=None, billing_address=None, shipping_address=None):
|
||||||
d = frappe.get_all('Address', filters={'name': address_name}, fields=['*'])[0]
|
d = frappe.get_all('Address', filters={'name': address_name}, fields=['*'])[0]
|
||||||
|
|
||||||
if (not d.gstin
|
if ((not d.gstin and not shipping_address)
|
||||||
or not d.city
|
or not d.city
|
||||||
or not d.pincode
|
or not d.pincode
|
||||||
or not d.address_title
|
or not d.address_title
|
||||||
@@ -108,8 +108,7 @@ def get_party_details(address_name):
|
|||||||
# according to einvoice standard
|
# according to einvoice standard
|
||||||
pincode = 999999
|
pincode = 999999
|
||||||
|
|
||||||
return frappe._dict(dict(
|
party_address_details = frappe._dict(dict(
|
||||||
gstin=d.gstin,
|
|
||||||
legal_name=sanitize_for_json(d.address_title),
|
legal_name=sanitize_for_json(d.address_title),
|
||||||
location=sanitize_for_json(d.city),
|
location=sanitize_for_json(d.city),
|
||||||
pincode=d.pincode,
|
pincode=d.pincode,
|
||||||
@@ -117,6 +116,9 @@ def get_party_details(address_name):
|
|||||||
address_line1=sanitize_for_json(d.address_line1),
|
address_line1=sanitize_for_json(d.address_line1),
|
||||||
address_line2=sanitize_for_json(d.address_line2)
|
address_line2=sanitize_for_json(d.address_line2)
|
||||||
))
|
))
|
||||||
|
if d.gstin:
|
||||||
|
party_address_details.gstin = d.gstin
|
||||||
|
return party_address_details
|
||||||
|
|
||||||
def get_gstin_details(gstin):
|
def get_gstin_details(gstin):
|
||||||
if not hasattr(frappe.local, 'gstin_cache'):
|
if not hasattr(frappe.local, 'gstin_cache'):
|
||||||
@@ -328,12 +330,12 @@ def make_einvoice(invoice):
|
|||||||
item_list = get_item_list(invoice)
|
item_list = get_item_list(invoice)
|
||||||
doc_details = get_doc_details(invoice)
|
doc_details = get_doc_details(invoice)
|
||||||
invoice_value_details = get_invoice_value_details(invoice)
|
invoice_value_details = get_invoice_value_details(invoice)
|
||||||
seller_details = get_party_details(invoice.company_address)
|
seller_details = get_party_details(invoice.company_address, company_address=1)
|
||||||
|
|
||||||
if invoice.gst_category == 'Overseas':
|
if invoice.gst_category == 'Overseas':
|
||||||
buyer_details = get_overseas_address_details(invoice.customer_address)
|
buyer_details = get_overseas_address_details(invoice.customer_address)
|
||||||
else:
|
else:
|
||||||
buyer_details = get_party_details(invoice.customer_address)
|
buyer_details = get_party_details(invoice.customer_address, billing_address=1)
|
||||||
place_of_supply = get_place_of_supply(invoice, invoice.doctype)
|
place_of_supply = get_place_of_supply(invoice, invoice.doctype)
|
||||||
if place_of_supply:
|
if place_of_supply:
|
||||||
place_of_supply = place_of_supply.split('-')[0]
|
place_of_supply = place_of_supply.split('-')[0]
|
||||||
@@ -346,7 +348,7 @@ def make_einvoice(invoice):
|
|||||||
if invoice.gst_category == 'Overseas':
|
if invoice.gst_category == 'Overseas':
|
||||||
shipping_details = get_overseas_address_details(invoice.shipping_address_name)
|
shipping_details = get_overseas_address_details(invoice.shipping_address_name)
|
||||||
else:
|
else:
|
||||||
shipping_details = get_party_details(invoice.shipping_address_name)
|
shipping_details = get_party_details(invoice.shipping_address_name, shipping_address=1)
|
||||||
|
|
||||||
if invoice.is_pos and invoice.base_paid_amount:
|
if invoice.is_pos and invoice.base_paid_amount:
|
||||||
payment_details = get_payment_details(invoice)
|
payment_details = get_payment_details(invoice)
|
||||||
|
|||||||
Reference in New Issue
Block a user