Moved the sort_post_txn_records utility and the logic to create the form to TransactionForm in the accounting application.

This commit is contained in:
依瑪貓
2020-08-19 13:38:05 +08:00
parent 8770770b66
commit 6f019d23c0
4 changed files with 65 additions and 61 deletions

View File

@ -823,11 +823,7 @@ class TransactionFormView(FormView):
def make_form_from_post(self, post: Dict[str, str]) -> TransactionForm:
"""Creates and returns the form from the POST data."""
utils.sort_post_txn_records(post)
form = TransactionForm(post)
form.txn_type = self.txn_type
form.transaction = self.object
return form
return TransactionForm.from_post(post, self.txn_type, self.object)
def make_form_from_model(self, obj: Transaction) -> TransactionForm:
"""Creates and returns the form from a data model."""