Skip to content

Commit e8ee5e8

Browse files
ljain112sameer8848digital
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 9bc362c commit e8ee5e8

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
@@ -481,7 +481,7 @@ function get_generate_e_waybill_dialog(opts, frm) {
481481
},
482482
];
483483

484-
if (frm.doctype === "Sales Invoice" && is_foreign_transaction) {
484+
if (["Sales Invoice","Delivery Note"].includes(frm.doctype) && is_foreign_transaction) {
485485
fields.splice(5, 0, {
486486
label: "Origin Port / Border Checkpost Address",
487487
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")
@@ -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+
2846
def get_dashboard_data(data):
2947
return update_dashboard_with_gst_logs(
3048
"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
@@ -1048,7 +1048,7 @@ def update_transaction(doc, values):
10481048
"gst_vehicle_type": values.gst_vehicle_type,
10491049
}
10501050

1051-
if doc.doctype == "Sales Invoice":
1051+
if doc.doctype in ["Sales Invoice", "Delivery Note"]:
10521052
data["port_address"] = values.port_address
10531053

10541054
doc.db_set(data)

india_compliance/hooks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@
135135
"before_save": "india_compliance.gst_india.overrides.transaction.update_gst_details",
136136
"before_submit": "india_compliance.gst_india.overrides.transaction.update_gst_details",
137137
"before_cancel": "india_compliance.gst_india.utils.e_waybill.before_cancel",
138-
"validate": (
139-
"india_compliance.gst_india.overrides.transaction.validate_transaction"
140-
),
138+
"validate": "india_compliance.gst_india.overrides.delivery_note.validate",
141139
},
142140
"Email Template": {
143141
"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)