From bf20fc8a7229d658c533bc02255da57697c7c056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 7 Jul 2020 07:12:26 +0800 Subject: [PATCH] Added the has_many_same_day property to the accounting transactions. --- accounting/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/accounting/models.py b/accounting/models.py index b6a60eb..864e82b 100644 --- a/accounting/models.py +++ b/accounting/models.py @@ -102,7 +102,12 @@ class Transaction(models.Model): def is_balanced(self, value): self._is_balanced = value - _has_order_hole = None + @property + def has_many_same_day(self): + """whether there are more than one transactions at this day, + so that the user can sort their orders. """ + return Transaction.objects.filter( + date=self.date).count() > 1 @property def has_order_hole(self):