From 93ba086548fa70314543afee54de00bdfef3c58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Fri, 24 Mar 2023 09:15:29 +0800 Subject: [PATCH] Simplified the code in the query_values pseudo property of the JournalEntryLineItem data model. --- src/accounting/models.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/accounting/models.py b/src/accounting/models.py index aee909a..6f5fb8a 100644 --- a/src/accounting/models.py +++ b/src/accounting/models.py @@ -770,12 +770,10 @@ class JournalEntryLineItem(db.Model): frac: Decimal = (value - whole).normalize() return str(whole) + str(abs(frac))[1:] - journal_entry_day: date = self.journal_entry.date - description: str = "" if self.description is None else self.description - return [description, - "{}/{}/{}".format(journal_entry_day.year, - journal_entry_day.month, - journal_entry_day.day), + return ["{}/{}/{}".format(self.journal_entry.date.year, + self.journal_entry.date.month, + self.journal_entry.date.day), + "" if self.description is None else self.description, format_amount(self.amount)]