Skip to content

Commit

Permalink
Merge pull request #1238 from resilient-tech/version-14-hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
vorasmit authored Nov 2, 2023
2 parents 012ec71 + 6c8ec17 commit fa7af85
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ frappe.ui.form.on("Sales Invoice", {
() => show_cancel_e_invoice_dialog(frm),
"e-Invoice"
);

india_compliance.make_text_red("e-Invoice", "Cancel");
}
},
async on_submit(frm) {
Expand Down Expand Up @@ -136,6 +138,7 @@ function show_cancel_e_invoice_dialog(frm, callback) {
},
});

india_compliance.primary_to_danger_btn(d);
d.show();
}

Expand Down
11 changes: 9 additions & 2 deletions india_compliance/gst_india/client_scripts/e_waybill_actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% include "india_compliance/gst_india/client_scripts/e_waybill_applicability.js" %}

E_WAYBILL_CLASS = {
const E_WAYBILL_CLASS = {
"Sales Invoice": SalesInvoiceEwaybill,
"Purchase Invoice": PurchaseInvoiceEwaybill,
"Delivery Note": DeliveryNoteEwaybill,
Expand Down Expand Up @@ -135,18 +135,24 @@ function setup_e_waybill_actions(doctype) {

if (frappe.perm.has_perm(frm.doctype, 0, "cancel", frm.doc.name)) {
if (is_e_waybill_cancellable(frm)) {
india_compliance.add_divider_to_btn_group("e-Waybill");

frm.add_custom_button(
__("Cancel"),
() => show_cancel_e_waybill_dialog(frm),
"e-Waybill"
);

india_compliance.make_text_red("e-Waybill", "Cancel");
}

frm.add_custom_button(
__("Mark as Cancelled"),
() => show_mark_e_waybill_as_cancelled_dialog(frm),
"e-Waybill"
);

india_compliance.make_text_red("e-Waybill", "Mark as Cancelled");
}
},
async on_submit(frm) {
Expand Down Expand Up @@ -547,6 +553,7 @@ function show_cancel_e_waybill_dialog(frm, callback) {
},
});

india_compliance.primary_to_danger_btn(d);
d.show();
}

Expand Down Expand Up @@ -1143,4 +1150,4 @@ function show_sandbox_mode_indicator() {
</div>
`
);
}
}
2 changes: 1 addition & 1 deletion india_compliance/gst_india/utils/gstin_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _get_gstin_info(gstin, *, throw_error=True):

frappe.log_error(title="Failed to Fetch GSTIN Info", message=exc)
frappe.clear_last_message()
return
return frappe._dict()

business_name = (
response.tradeNam if response.ctb == "Proprietorship" else response.lgnm
Expand Down
21 changes: 21 additions & 0 deletions india_compliance/public/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,27 @@ Object.assign(india_compliance, {
last_month_end() {
return frappe.datetime.add_days(frappe.datetime.month_start(), -1);
},

primary_to_danger_btn(parent) {
parent.$wrapper.find(".btn-primary").removeClass("btn-primary").addClass("btn-danger");
},

add_divider_to_btn_group(btn_group_name) {
$(document).find(
`.inner-group-button[data-label=${btn_group_name}]`
)
.find(`.dropdown-menu`)
.append($('<li class="dropdown-divider"></li>'));
},

make_text_red(btn_group_name, btn_name) {
$(document).find(
`.inner-group-button[data-label=${btn_group_name}]`
)
.find(`.dropdown-item[data-label="${encodeURIComponent(btn_name)}"]`)
.addClass("text-danger");
},

});

function is_gstin_check_digit_valid(gstin) {
Expand Down
6 changes: 3 additions & 3 deletions india_compliance/setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def setup_company_gstin_details(params):
gstin_info = get_gstin_info(params.company_gstin, throw_error=False)

update_company_info(params, gstin_info.gst_category)
create_address(gstin_info)
create_address(gstin_info, params)


def update_company_info(params, gst_category=None):
Expand All @@ -74,13 +74,13 @@ def update_company_info(params, gst_category=None):
company_doc.save()


def create_address(gstin_info: dict) -> None:
def create_address(gstin_info: dict, params: dict) -> None:
if not gstin_info.permanent_address:
return

address = frappe.new_doc("Address")
address.append(
"links", {"link_doctype": "Company", "link_name": gstin_info.business_name}
"links", {"link_doctype": "Company", "link_name": params.company_name}
)

for key, value in gstin_info.permanent_address.items():
Expand Down

0 comments on commit fa7af85

Please sign in to comment.