Skip to content

Commit

Permalink
fix: for purchase invoice use msgprint instead of throw
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Dec 13, 2024
1 parent 132fecf commit 36966a1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions india_compliance/gst_india/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,24 +940,26 @@ def validate_invoice_number(doc, throw=True):
if not throw:
return is_valid_length and is_valid_format

if is_valid_length and is_valid_format:
return

title = _("Invalid GST Transaction Name")

if not is_valid_length:
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:
else:
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)

if doc.doctype == "Purchase Invoice":
frappe.msgprint(message, title=title)
return

frappe.throw(message, title=title)


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

0 comments on commit 36966a1

Please sign in to comment.