Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: GST Transporter ID Refactor #2198

Merged
merged 8 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
not self.enable_retry_einv_ewb_generation,
)

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

Check warning on line 95 in india_compliance/gst_india/doctype/gst_settings/gst_settings.py

View check run for this annotation

Codecov / codecov/patch

india_compliance/gst_india/doctype/gst_settings/gst_settings.py#L95

Added line #L95 was not covered by tests

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

Check warning on line 98 in india_compliance/gst_india/doctype/gst_settings/gst_settings.py

View check run for this annotation

Codecov / codecov/patch

india_compliance/gst_india/doctype/gst_settings/gst_settings.py#L98

Added line #L98 was not covered by tests

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

Check warning on line 101 in india_compliance/gst_india/doctype/gst_settings/gst_settings.py

View check run for this annotation

Codecov / codecov/patch

india_compliance/gst_india/doctype/gst_settings/gst_settings.py#L101

Added line #L101 was not covered by tests

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

Check warning on line 104 in india_compliance/gst_india/doctype/gst_settings/gst_settings.py

View check run for this annotation

Codecov / codecov/patch

india_compliance/gst_india/doctype/gst_settings/gst_settings.py#L104

Added line #L104 was not covered by tests

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

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

Check warning on line 111 in india_compliance/gst_india/doctype/gst_settings/gst_settings.py

View check run for this annotation

Codecov / codecov/patch

india_compliance/gst_india/doctype/gst_settings/gst_settings.py#L110-L111

Added lines #L110 - L111 were not covered by tests

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");
});
},
});
20 changes: 16 additions & 4 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",
vorasmit marked this conversation as resolved.
Show resolved Hide resolved
"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,6 +106,12 @@
"report": 1,
"role": "Accounts Manager",
"share": 1
},
{
"export": 1,
"read": 1,
"report": 1,
"role": "Accounts User"
}
],
"sort_field": "creation",
Expand Down
Loading