Skip to content

Commit

Permalink
test: minor change in test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Dec 13, 2024
1 parent 36966a1 commit 5131f45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 4 additions & 3 deletions india_compliance/gst_india/overrides/test_purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ def test_validate_invoice_length(self):
setattr(pinv, "__newname", "INV/2022/00001/asdfsadg") # NOQA
pinv.meta.autoname = "prompt"

self.assertRaisesRegex(
frappe.exceptions.ValidationError,
pinv.save()

self.assertEqual(
frappe.parse_json(frappe.message_log[-1]).get("message"),
"Transaction Name must be 16 characters or fewer to meet GST requirements",
pinv.save,
)
7 changes: 3 additions & 4 deletions india_compliance/gst_india/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,11 +955,10 @@ def validate_invoice_number(doc, throw=True):
" only contain alphanumeric characters, dash (-) and slash (/) to meet GST requirements"
)

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

frappe.throw(message, title=title)
frappe.msgprint(message, title=title)


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

0 comments on commit 5131f45

Please sign in to comment.