def METHOD_NAME(doc, method=None):
    if getattr(doc, "_submitted_from_ui", None) or validate_transaction(doc) is False:
        return
    gst_settings = frappe.get_cached_doc("GST Settings")
    if not is_api_enabled(gst_settings):
        return
    if (
        validate_e_invoice_applicability(doc, gst_settings, throw=False)
        and gst_settings.auto_generate_e_invoice
    ):
        frappe.enqueue(
            "india_compliance.gst_india.utils.e_invoice.generate_e_invoice",
            enqueue_after_commit=True,
            queue="short",
            docname=doc.name,
            throw=False,
        )
        return
    if gst_settings.auto_generate_e_waybill and is_e_waybill_applicable(
        doc, gst_settings
    ):
        frappe.enqueue(
            "india_compliance.gst_india.utils.e_waybill.generate_e_waybill",
            enqueue_after_commit=True,
            queue="short",
            doctype=doc.doctype,
            docname=doc.name,
        )