dded to return as "not modified" when the transaction was not modified in the accounting application.

This commit is contained in:
依瑪貓 2020-08-02 10:01:17 +08:00
parent 688e350017
commit 4561fa4b39

View File

@ -858,19 +858,19 @@ def txn_store(request, txn_type, txn=None):
if txn is None: if txn is None:
url = reverse("accounting:transactions.create", args=(txn_type,)) url = reverse("accounting:transactions.create", args=(txn_type,))
else: else:
url = reverse( url = reverse("accounting:transactions.edit", args=(txn_type, txn))
"accounting:transactions.edit", args=(txn_type, txn)) url = str(UrlBuilder(url).set("r", request.GET.get("r")))
return error_redirect( return error_redirect(request, url, post)
request,
str(UrlBuilder(url).set("r", request.GET.get("r"))),
post)
if txn is None: if txn is None:
txn = Transaction() txn = Transaction()
fill_txn_from_post(txn, post) fill_txn_from_post(txn, post)
if not txn.is_dirty():
url = reverse("accounting:transactions.show", args=(txn_type, txn))
url = str(UrlBuilder(url).set("r", request.GET.get("r")))
message = gettext_noop("This transaction was not modified.")
return success_redirect(request, url, message)
# TODO: Stores the data # TODO: Stores the data
return success_redirect( url = reverse("accounting:transactions.show", args=(txn_type, txn))
request, url = str(UrlBuilder(url).set("r", request.GET.get("r")))
str(UrlBuilder(reverse("accounting:transactions.show", message = gettext_noop("This transaction was saved successfully.")
args=(txn_type, txn))) return success_redirect(request, url, message)
.add("r", request.GET.get("r"))),
gettext_noop("This transaction was saved successfully."))