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" )
@@ -25,6 +36,13 @@ def onload(doc, method=None):
2536 doc .set_onload ("e_waybill_info" , e_waybill_info )
2637
2738
39+ def validate (doc , method = None ):
40+ if validate_transaction (doc ) is False :
41+ return
42+
43+ validate_port_address (doc )
44+
45+
2846def get_dashboard_data (data ):
2947 return update_dashboard_with_gst_logs (
3048 "Delivery Note" , data , "e-Waybill Log" , "Integration Request"
0 commit comments