Skip to content

Commit

Permalink
Merge pull request #2257 from resilient-tech/mergify/bp/version-14-ho…
Browse files Browse the repository at this point in the history
…tfix/pr-2198

fix: GST Transporter ID Refactor (backport #2198)
  • Loading branch information
mergify[bot] committed Jun 18, 2024
2 parents 9fd9877 + daefb6f commit 795a84f
Show file tree
Hide file tree
Showing 12 changed files with 328 additions and 243 deletions.
14 changes: 6 additions & 8 deletions india_compliance/gst_india/client_scripts/e_waybill_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ function show_generate_e_waybill_dialog(frm) {
);

d.show();
set_gst_transporter_id_status(d);
validate_gst_transporter_id(d);

//Alert if E-waybill cannot be generated using api
if (!is_e_waybill_generatable(frm)) {
Expand Down Expand Up @@ -374,7 +374,7 @@ function get_generate_e_waybill_dialog(opts, frm) {
frm.doc.gst_transporter_id?.length == 15
? frm.doc.gst_transporter_id
: "",
onchange: () => set_gst_transporter_id_status(d),
onchange: () => validate_gst_transporter_id(d),

},
// Sub Supply Type will be visible here for Delivery Note
Expand Down Expand Up @@ -814,7 +814,7 @@ function show_update_transporter_dialog(frm) {
frm.doc.gst_transporter_id.length == 15
? frm.doc.gst_transporter_id
: "",
onchange: () => set_gst_transporter_id_status(d),
onchange: () => validate_gst_transporter_id(d),
},
{
label: "Update e-Waybill Print/Data",
Expand All @@ -841,7 +841,7 @@ function show_update_transporter_dialog(frm) {
// To prevent triggering of change event on input twice
frappe.ui.form.ControlData.trigger_change_on_input_event = true;
d.show();
set_gst_transporter_id_status(d);
validate_gst_transporter_id(d);
}

async function show_extend_validity_dialog(frm) {
Expand Down Expand Up @@ -1161,10 +1161,8 @@ async function update_gst_tranporter_id(dialog) {
dialog.set_value("gst_transporter_id", response.gst_transporter_id);
}

function set_gst_transporter_id_status(dialog) {
const gst_transporter_id_field = dialog.get_field("gst_transporter_id");

india_compliance.set_gstin_status(gst_transporter_id_field);
function validate_gst_transporter_id(dialog) {
india_compliance.validate_gst_transporter_id(dialog.get_value("gst_transporter_id"));
}

function update_generation_dialog(dialog, doc) {
Expand Down
9 changes: 1 addition & 8 deletions india_compliance/gst_india/client_scripts/supplier.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ frappe.ui.form.on(DOCTYPE, {
},

gst_transporter_id(frm) {
if (
!frm.doc.gst_transporter_id ||
frm.doc.gst_transporter_id.length < 15
)
return;

gst_transporter_id_field = frm.get_field("gst_transporter_id");
india_compliance.set_gstin_status(gst_transporter_id_field);
india_compliance.validate_gst_transporter_id(frm.doc.gst_transporter_id);
},
});
20 changes: 20 additions & 0 deletions india_compliance/gst_india/doctype/gst_settings/gst_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,26 @@ def update_retry_e_invoice_e_waybill_scheduled_job(self):
not self.enable_retry_einv_ewb_generation,
)

def get_gstin_with_credentials(self, service=None):
if not service:
return

if service == "Returns" and not self:
return

if service == "e-Waybill" and not self.enable_e_waybill:
return

if service == "e-Invoice" and not self.enable_e_invoice:
return

if service in ["e-Invoice", "e-Waybill"]:
service = "e-Waybill / e-Invoice"

for row in self.credentials:
if row.service == service:
return row.gstin

def validate_gst_accounts(self):
account_list = []
company_wise_account_types = {}
Expand Down
6 changes: 5 additions & 1 deletion india_compliance/gst_india/doctype/gstin/gstin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ frappe.ui.form.on("GSTIN", {
refresh(frm) {
frm.disable_form();

frm.add_custom_button(__("Refresh Now"), () => {
frm.add_custom_button(__("Refresh GSTIN Status"), () => {
frm.call("update_gstin_status");
});

frm.add_custom_button(__("Refresh Transporter ID Status"), () => {
frm.call("update_transporter_id_status");
});
},
});
22 changes: 17 additions & 5 deletions india_compliance/gst_india/doctype/gstin/gstin.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"gstin",
"registration_date",
"status",
"is_blocked",
"transporter_id_status",
"column_break_nrjd",
"last_updated_on",
"cancelled_date",
"is_blocked",
"section_break_ttzc",
"gstr_1_filed_upto"
],
Expand All @@ -30,8 +31,7 @@
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Status",
"reqd": 1
"label": "GSTIN Status"
},
{
"fieldname": "registration_date",
Expand Down Expand Up @@ -62,6 +62,12 @@
"in_standard_filter": 1,
"label": "Is Blocked"
},
{
"fieldname": "transporter_id_status",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Transporter ID Status"
},
{
"fieldname": "section_break_ttzc",
"fieldtype": "Section Break"
Expand All @@ -76,7 +82,7 @@
"in_create": 1,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-05-17 15:38:05.867522",
"modified": "2024-06-14 13:59:53.998262",
"modified_by": "Administrator",
"module": "GST India",
"name": "GSTIN",
Expand All @@ -100,9 +106,15 @@
"report": 1,
"role": "Accounts Manager",
"share": 1
},
{
"export": 1,
"read": 1,
"report": 1,
"role": "Accounts User"
}
],
"sort_field": "modified",
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"title_field": "gstin"
Expand Down

0 comments on commit 795a84f

Please sign in to comment.