Moved the fill_txn_from_post() and _find_max_record_no() utilities to the fill_from_post() method in the transaction data model in the accounting application.

This commit is contained in:
依瑪貓
2020-08-19 14:08:17 +08:00
parent 0e1a87184b
commit b8f852c5f2
3 changed files with 95 additions and 97 deletions

View File

@ -832,9 +832,7 @@ class TransactionFormView(FormView):
def fill_model_from_form(self, obj: Transaction,
form: TransactionForm) -> None:
"""Fills in the data model from the form."""
obj.old_date = obj.date
utils.fill_txn_from_post(self.txn_type, obj, form.data)
obj.current_user = self.request.user
obj.fill_from_post(form.data, self.request, self.txn_type)
def get_object(self) -> Optional[Account]:
"""Returns the current object, or None on a create form."""