Simplified the super method calls in the data models in the accounting application.
This commit is contained in:
parent
3f250d9958
commit
2986d6d231
@ -76,8 +76,7 @@ class Account(DirtyFieldsMixin, models.Model):
|
|||||||
if current_user is not None:
|
if current_user is not None:
|
||||||
self.updated_by = current_user
|
self.updated_by = current_user
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
super(Account, self).save(
|
super().save(force_insert=force_insert, force_update=force_update,
|
||||||
force_insert=force_insert, force_update=force_update,
|
|
||||||
using=using, update_fields=update_fields)
|
using=using, update_fields=update_fields)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -178,8 +177,7 @@ class Transaction(DirtyFieldsMixin, models.Model):
|
|||||||
bool: True if the data of this transaction is changed and need
|
bool: True if the data of this transaction is changed and need
|
||||||
to be saved into the database, or False otherwise.
|
to be saved into the database, or False otherwise.
|
||||||
"""
|
"""
|
||||||
if super(Transaction, self).is_dirty(
|
if super().is_dirty(check_relationship=check_relationship,
|
||||||
check_relationship=check_relationship,
|
|
||||||
check_m2m=check_m2m):
|
check_m2m=check_m2m):
|
||||||
return True
|
return True
|
||||||
if len([x for x in self.records
|
if len([x for x in self.records
|
||||||
@ -253,8 +251,7 @@ class Transaction(DirtyFieldsMixin, models.Model):
|
|||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
for record in self.record_set.all():
|
for record in self.record_set.all():
|
||||||
record.delete()
|
record.delete()
|
||||||
super(Transaction, self).delete(
|
super().delete(using=using, keep_parents=keep_parents)
|
||||||
using=using, keep_parents=keep_parents)
|
|
||||||
for txn in txn_to_sort:
|
for txn in txn_to_sort:
|
||||||
txn.save()
|
txn.save()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user