Revised the txn_form view to constructs the new transaction form without having to bother the make_txn_form_from_model() utility, in order not to mess up with the is_bound form property, to replace the need for the should_validate template variable, and removed all the should_validate template variables from the transaction form templates in the accounting application.
This commit is contained in:
@ -294,7 +294,7 @@ class TransactionForm(forms.Form):
|
||||
int: The total amount of the credit records.
|
||||
"""
|
||||
return sum([int(x.data["amount"]) for x in self.debit_records
|
||||
if "amount" not in x.errors])
|
||||
if "amount" in x.data and "amount" not in x.errors])
|
||||
|
||||
def credit_total(self):
|
||||
"""Returns the total amount of the credit records.
|
||||
@ -303,7 +303,7 @@ class TransactionForm(forms.Form):
|
||||
int: The total amount of the credit records.
|
||||
"""
|
||||
return sum([int(x.data["amount"]) for x in self.credit_records
|
||||
if "amount" not in x.errors])
|
||||
if "amount" in x.data and "amount" not in x.errors])
|
||||
|
||||
|
||||
class AccountForm(forms.Form):
|
||||
|
Reference in New Issue
Block a user