Skip to content

Commit

Permalink
fix: remove show_msg check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Dec 10, 2024
1 parent 43cfdca commit bbcdc20
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function setup_e_waybill_actions(doctype) {

frappe.validated = false;

return new Promise((resolve) => {
return new Promise(resolve => {
const continueCancellation = () => {
frappe.validated = true;
resolve();
Expand Down
2 changes: 1 addition & 1 deletion india_compliance/gst_india/overrides/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def auto_cancel(cancel_func, action_type):
"remark": "",
}
)
cancel_func(doc, values, show_msg=False)
cancel_func(doc, values)

if doc.irn and gst_settings.enable_e_invoice and gst_settings.auto_cancel_e_invoice:
auto_cancel(_cancel_e_invoice, "e_invoice")
Expand Down
15 changes: 6 additions & 9 deletions india_compliance/gst_india/utils/e_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ def cancel_e_invoice(docname, values):
return send_updated_doc(doc)


def _cancel_e_invoice(doc, values, show_msg=True):
def _cancel_e_invoice(doc, values):
validate_if_e_invoice_can_be_cancelled(doc)

if doc.get("ewaybill"):
_cancel_e_waybill(doc, values, show_msg)
_cancel_e_waybill(doc, values)

data = {
"Irn": doc.irn,
Expand All @@ -352,15 +352,13 @@ def _cancel_e_invoice(doc, values, show_msg=True):
result = EInvoiceAPI(doc).cancel_irn(data)

log_and_process_e_invoice_cancellation(
doc, values, result, "e-Invoice cancelled successfully", show_msg=show_msg
doc, values, result, "e-Invoice cancelled successfully"
)

# TODO: Improve this implementation
if show_msg:
doc.cancel()
doc.cancel()


def log_and_process_e_invoice_cancellation(doc, values, result, message, show_msg=True):
def log_and_process_e_invoice_cancellation(doc, values, result, message):
log_e_invoice(
doc,
{
Expand All @@ -383,8 +381,7 @@ def log_and_process_e_invoice_cancellation(doc, values, result, message, show_ms
}
)

if show_msg:
frappe.msgprint(_(message), indicator="green", alert=True)
frappe.msgprint(_(message), indicator="green", alert=True)


@frappe.whitelist()
Expand Down
13 changes: 6 additions & 7 deletions india_compliance/gst_india/utils/e_waybill.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def cancel_e_waybill(*, doctype, docname, values):
return send_updated_doc(doc)


def _cancel_e_waybill(doc, values, show_msg=True):
def _cancel_e_waybill(doc, values):
"""Separate function, since called in backend from e-invoice utils"""

e_waybill_data = EWaybillData(doc)
Expand All @@ -282,12 +282,11 @@ def _cancel_e_waybill(doc, values, show_msg=True):

log_and_process_e_waybill_cancellation(doc, values, result)

if show_msg:
frappe.msgprint(
_("e-Waybill cancelled successfully"),
indicator="green",
alert=True,
)
frappe.msgprint(
_("e-Waybill cancelled successfully"),
indicator="green",
alert=True,
)


def log_and_process_e_waybill_cancellation(doc, values, result):
Expand Down

0 comments on commit bbcdc20

Please sign in to comment.