Simplified the super method calls in the data models in the accounting application.

This commit is contained in:
依瑪貓 2020-08-12 22:29:03 +08:00
parent 3f250d9958
commit 2986d6d231

View File

@ -76,8 +76,7 @@ class Account(DirtyFieldsMixin, models.Model):
if current_user is not None:
self.updated_by = current_user
with transaction.atomic():
super(Account, self).save(
force_insert=force_insert, force_update=force_update,
super().save(force_insert=force_insert, force_update=force_update,
using=using, update_fields=update_fields)
class Meta:
@ -178,8 +177,7 @@ class Transaction(DirtyFieldsMixin, models.Model):
bool: True if the data of this transaction is changed and need
to be saved into the database, or False otherwise.
"""
if super(Transaction, self).is_dirty(
check_relationship=check_relationship,
if super().is_dirty(check_relationship=check_relationship,
check_m2m=check_m2m):
return True
if len([x for x in self.records
@ -253,8 +251,7 @@ class Transaction(DirtyFieldsMixin, models.Model):
with transaction.atomic():
for record in self.record_set.all():
record.delete()
super(Transaction, self).delete(
using=using, keep_parents=keep_parents)
super().delete(using=using, keep_parents=keep_parents)
for txn in txn_to_sort:
txn.save()