Simplified the code in the sort_form_transaction_records() utility in the accounting application.

This commit is contained in:
依瑪貓 2020-07-29 09:38:34 +08:00
parent 7ec25d89a8
commit 758af556fc

View File

@ -400,9 +400,9 @@ def sort_form_transaction_records(form):
new_form[F"{rec_type}-{no}-{attr}"]\ new_form[F"{rec_type}-{no}-{attr}"]\
= form[F"{rec_type}-{old_no}-{attr}"] = form[F"{rec_type}-{old_no}-{attr}"]
# Purges the old form and fills it with the new form # Purges the old form and fills it with the new form
old_keys = [x for x in form.keys() if re.match( for x in [x for x in form.keys() if re.match(
"^(debit|credit)-([1-9][0-9]*)-(sn|ord|account|summary|amount)", x)] "^(debit|credit)-([1-9][0-9]*)-(sn|ord|account|summary|amount)",
for x in old_keys: x)]:
del form[x] del form[x]
for key in new_form.keys(): for key in new_form.keys():
form[key] = new_form[key] form[key] = new_form[key]