Applied the form to existing transactions in the accounting application.

This commit is contained in:
2020-07-28 03:07:37 +08:00
parent 95ffeff8cb
commit b11348b276
5 changed files with 8 additions and 6 deletions

View File

@ -862,17 +862,19 @@ def transaction_show(request, type, transaction):
@require_GET
@digest_login_required
def transaction_create(request, type):
def transaction_create(request, type, transaction=None):
"""The view to create an accounting transaction.
Args:
request (HttpRequest): The request.
type (str): The transaction type.
transaction (Transaction: The transaction.
Returns:
HttpResponse: The response.
"""
transaction = Transaction()
if transaction is None:
transaction = Transaction()
if len(transaction.debit_records) == 0:
transaction.records.append(Record(ord=1, is_credit=False))
if len(transaction.credit_records) == 0: