11import frappe
22
33from india_compliance .gst_india .overrides .sales_invoice import (
4+ is_e_waybill_applicable ,
5+ is_shipping_address_in_india ,
46 update_dashboard_with_gst_logs ,
7+ validate_port_address ,
8+ )
9+ from india_compliance .gst_india .overrides .transaction import (
10+ validate_transaction ,
511)
612from india_compliance .gst_india .utils import is_api_enabled
713from india_compliance .gst_india .utils .e_waybill import get_e_waybill_info
814
915
1016def onload (doc , method = None ):
1117 if not doc .get ("ewaybill" ):
18+ if doc .gst_category == "Overseas" and is_e_waybill_applicable (doc ):
19+
20+ doc .set_onload (
21+ "shipping_address_in_india" , is_shipping_address_in_india (doc )
22+ )
1223 return
1324
1425 gst_settings = frappe .get_cached_doc ("GST Settings" )
@@ -24,6 +35,13 @@ def onload(doc, method=None):
2435 doc .set_onload ("e_waybill_info" , e_waybill_info )
2536
2637
38+ def validate (doc , method = None ):
39+ if validate_transaction (doc ) is False :
40+ return
41+
42+ validate_port_address (doc )
43+
44+
2745def get_dashboard_data (data ):
2846 return update_dashboard_with_gst_logs (
2947 "Delivery Note" , data , "e-Waybill Log" , "Integration Request"
0 commit comments