Replaced the get_absolute_url() method in the transaction data model with the get_success_url() method in the transaction form model, and added the current application to the arguments to enable multiple instances of the application in the accounting application.
This commit is contained in:
@ -160,18 +160,6 @@ class Transaction(DirtyFieldsMixin, models.Model):
|
||||
transaction."""
|
||||
return self.date.__str__() + " #" + self.ord.__str__()
|
||||
|
||||
def get_absolute_url(self) -> str:
|
||||
"""Returns the URL to view this transaction."""
|
||||
if self.is_cash_expense:
|
||||
return reverse(
|
||||
"accounting:transactions.detail", args=("expense", self))
|
||||
elif self.is_cash_income:
|
||||
return reverse(
|
||||
"accounting:transactions.detail", args=("income", self))
|
||||
else:
|
||||
return reverse(
|
||||
"accounting:transactions.detail", args=("transfer", self))
|
||||
|
||||
def is_dirty(self, check_relationship=False, check_m2m=None) -> bool:
|
||||
"""Returns whether the data of this transaction is changed and need
|
||||
to be saved into the database.
|
||||
|
Reference in New Issue
Block a user