Removed the unnecessary setting the current usr in the TransactionFormView and AccountFormView in the accounting application.

This commit is contained in:
依瑪貓 2020-08-18 10:02:53 +08:00
parent 321165a50f
commit 31c1c7c35a

View File

@ -837,7 +837,6 @@ class TransactionFormView(FormView):
"""Fills in the data model from the form.""" """Fills in the data model from the form."""
obj.old_date = obj.date obj.old_date = obj.date
utils.fill_txn_from_post(self.txn_type, obj, form.data) utils.fill_txn_from_post(self.txn_type, obj, form.data)
obj.current_user = self.request.user
def get_object(self) -> Optional[Account]: def get_object(self) -> Optional[Account]:
"""Returns the current object, or None on a create form.""" """Returns the current object, or None on a create form."""
@ -954,12 +953,6 @@ class AccountFormView(FormView):
form.account = obj form.account = obj
return form return form
def fill_model_from_form(self, obj: Account, form: AccountForm) -> None:
"""Fills in the data model from the form."""
obj.code = form["code"].value()
obj.title = form["title"].value()
obj.current_user = self.request.user
def get_object(self) -> Optional[Account]: def get_object(self) -> Optional[Account]:
"""Returns the current object, or None on a create form.""" """Returns the current object, or None on a create form."""
return self.kwargs.get("account") return self.kwargs.get("account")