Skip to content

Commit e386068

Browse files
ljain112mergify[bot]
authored andcommitted
feat: ability to specify Origin Port / Border Checkpost Address for the purpose of e-Waybill in delivery note
(cherry picked from commit fcde723)
1 parent ca30b13 commit e386068

7 files changed

Lines changed: 45 additions & 22 deletions

File tree

india_compliance/gst_india/client_scripts/delivery_note.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ const DOCTYPE = "Delivery Note";
22
setup_e_waybill_actions(DOCTYPE);
33

44
frappe.ui.form.on(DOCTYPE, {
5+
setup(frm) {
6+
frm.set_query("port_address", {
7+
filters: {
8+
country: "India",
9+
},
10+
});
11+
},
512
refresh(frm) {
613
if (!gst_settings.enable_e_waybill || !gst_settings.enable_e_waybill_from_dn)
714
return;

india_compliance/gst_india/client_scripts/e_waybill_actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ function get_generate_e_waybill_dialog(opts, frm) {
480480
},
481481
];
482482

483-
if (frm.doctype === "Sales Invoice" && is_foreign_transaction) {
483+
if (["Sales Invoice","Delivery Note"].includes(frm.doctype) && is_foreign_transaction) {
484484
fields.splice(5, 0, {
485485
label: "Origin Port / Border Checkpost Address",
486486
fieldname: "port_address",

india_compliance/gst_india/constants/custom_fields.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,22 @@
632632
],
633633
# Sales Shipping Fields
634634
("Delivery Note", "Sales Invoice"): [
635+
{
636+
"fieldname": "port_address",
637+
"label": "Origin Port / Border Checkpost Address Name",
638+
"fieldtype": "Link",
639+
"options": "Address",
640+
"print_hide": 1,
641+
"description": (
642+
"Address of the place / port in India from where goods are being"
643+
" exported <br>(for generating e-Waybill against export of goods)"
644+
),
645+
"insert_after": "shipping_address",
646+
"depends_on": (
647+
"eval:doc.company_gstin && doc.gst_category === 'Overseas' &&"
648+
" doc.place_of_supply == '96-Other Countries' && gst_settings.enable_e_waybill"
649+
),
650+
},
635651
{
636652
"fieldname": "port_code",
637653
"label": "Port Code",
@@ -937,22 +953,6 @@
937953
},
938954
],
939955
"Sales Invoice": [
940-
{
941-
"fieldname": "port_address",
942-
"label": "Origin Port / Border Checkpost Address Name",
943-
"fieldtype": "Link",
944-
"options": "Address",
945-
"print_hide": 1,
946-
"description": (
947-
"Address of the place / port in India from where goods are being"
948-
" exported <br>(for generating e-Waybill against export of goods)"
949-
),
950-
"insert_after": "shipping_address",
951-
"depends_on": (
952-
"eval:doc.company_gstin && doc.gst_category === 'Overseas' &&"
953-
" doc.place_of_supply == '96-Other Countries' && gst_settings.enable_e_waybill"
954-
),
955-
},
956956
{
957957
"fieldname": "invoice_copy",
958958
"label": "Invoice Copy",

india_compliance/gst_india/overrides/delivery_note.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
import frappe
22

33
from 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
)
612
from india_compliance.gst_india.utils import is_api_enabled
713
from india_compliance.gst_india.utils.e_waybill import get_e_waybill_info
814

915

1016
def 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+
2745
def get_dashboard_data(data):
2846
return update_dashboard_with_gst_logs(
2947
"Delivery Note", data, "e-Waybill Log", "Integration Request"

india_compliance/gst_india/utils/e_waybill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ def update_transaction(doc, values):
10521052
"gst_vehicle_type": values.gst_vehicle_type,
10531053
}
10541054

1055-
if doc.doctype == "Sales Invoice":
1055+
if doc.doctype in ["Sales Invoice", "Delivery Note"]:
10561056
data["port_address"] = values.port_address
10571057

10581058
doc.db_set(data)

india_compliance/hooks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@
136136
"before_save": "india_compliance.gst_india.overrides.transaction.update_gst_details",
137137
"before_submit": "india_compliance.gst_india.overrides.transaction.update_gst_details",
138138
"before_cancel": "india_compliance.gst_india.utils.e_waybill.before_cancel",
139-
"validate": (
140-
"india_compliance.gst_india.overrides.transaction.validate_transaction"
141-
),
139+
"validate": "india_compliance.gst_india.overrides.delivery_note.validate",
142140
},
143141
"Email Template": {
144142
"after_rename": "india_compliance.gst_india.overrides.email_template.after_rename",

india_compliance/patches.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ india_compliance.patches.v15.remove_duplicate_web_template
44

55
[post_model_sync]
66
india_compliance.patches.v14.set_default_for_overridden_accounts_setting
7-
execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #65
7+
execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #66
88
execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #11
99
execute:from india_compliance.income_tax_india.setup import create_custom_fields; create_custom_fields() #4
1010
india_compliance.patches.post_install.remove_old_fields #2

0 commit comments

Comments
 (0)