Skip to content

Commit

Permalink
fix: show error message instead of throw
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Dec 13, 2024
1 parent 703df38 commit 132fecf
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions india_compliance/gst_india/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,22 +940,24 @@ def validate_invoice_number(doc, throw=True):
if not throw:
return is_valid_length and is_valid_format

title = _("Invalid GST Transaction Name")

if not is_valid_length:
frappe.throw(
_(
"Transaction Name must be 16 characters or fewer to meet GST requirements"
),
title=_("Invalid GST Transaction Name"),
message = _(
"Transaction Name must be 16 characters or fewer to meet GST requirements"
)
if doc.doctype == "Purchase Invoice":
frappe.msgprint(message, title=title)
return

frappe.throw(message, title=title)

if not is_valid_format:
frappe.throw(
_(
"Transaction Name should start with an alphanumeric character and can"
" only contain alphanumeric characters, dash (-) and slash (/) to meet GST requirements"
),
title=_("Invalid GST Transaction Name"),
message = _(
"Transaction Name should start with an alphanumeric character and can"
" only contain alphanumeric characters, dash (-) and slash (/) to meet GST requirements"
)
frappe.throw(message, title=title)


def handle_server_errors(settings, doc, document_type, error):
Expand Down

0 comments on commit 132fecf

Please sign in to comment.