Skip to content

Commit

Permalink
fix: backend autogenerate e_waybill if e_invoice is not applicable
Browse files Browse the repository at this point in the history
(cherry picked from commit 66995e9)
  • Loading branch information
vorasmit authored and mergify[bot] committed Nov 17, 2022
1 parent 99bc65a commit 46eec55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 5 additions & 8 deletions india_compliance/gst_india/overrides/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,10 @@ def on_submit(doc, method=None):
if not is_api_enabled(gst_settings):
return

if gst_settings.enable_e_invoice:
if (
not gst_settings.auto_generate_e_invoice
or not validate_e_invoice_applicability(doc, gst_settings, throw=False)
):
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,
Expand All @@ -125,7 +122,7 @@ def on_submit(doc, method=None):

return

if (
elif (
not gst_settings.enable_e_waybill
or not gst_settings.auto_generate_e_waybill
or doc.ewaybill
Expand Down
3 changes: 3 additions & 0 deletions india_compliance/gst_india/utils/e_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ def _throw(error):
if not gst_settings:
gst_settings = frappe.get_cached_doc("GST Settings")

if not gst_settings.enable_e_invoice:
return _throw(_("e-Invoice is not enabled in GST Settings"))

if getdate(gst_settings.e_invoice_applicable_from) > getdate(doc.posting_date):
return _throw(
_(
Expand Down

0 comments on commit 46eec55

Please sign in to comment.