From eac77c725a9b5f6d28cff2d6ffcf15d306d300a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Fri, 7 Aug 2020 00:58:33 +0800 Subject: [PATCH] Renamed the is_credit_card_paid() utility to is_payable(), and implemented it in the accounting application. --- .../locale/zh_Hant/LC_MESSAGES/django.po | 9 ++++-- accounting/models.py | 15 ++-------- accounting/templates/accounting/ledger.html | 12 ++++---- accounting/utils.py | 29 +++++++++++++++++++ accounting/views.py | 3 +- mia_core/locale/zh_Hant/LC_MESSAGES/django.po | 2 +- 6 files changed, 47 insertions(+), 23 deletions(-) diff --git a/accounting/locale/zh_Hant/LC_MESSAGES/django.po b/accounting/locale/zh_Hant/LC_MESSAGES/django.po index b4c2980..293b01c 100644 --- a/accounting/locale/zh_Hant/LC_MESSAGES/django.po +++ b/accounting/locale/zh_Hant/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: mia-js 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-06 23:59+0800\n" -"PO-Revision-Date: 2020-08-07 00:01+0800\n" +"POT-Creation-Date: 2020-08-07 00:37+0800\n" +"PO-Revision-Date: 2020-08-07 00:38+0800\n" "Last-Translator: imacat \n" "Language-Team: Traditional Chinese \n" "Language: Traditional Chinese\n" @@ -496,7 +496,7 @@ msgstr "%(prep_period)s%(account)s的分類帳" #: accounting/templates/accounting/ledger.html:112 #: accounting/templates/accounting/ledger.html:159 -msgid "Unpaid" +msgid "Payable" msgstr "未付款" #: accounting/templates/accounting/ledger.html:116 @@ -756,3 +756,6 @@ msgstr "-----使用中科目-----" #: accounting/views.py:1080 msgid "---Accounts Not In Use---" msgstr "-----未使用科目-----" + +#~ msgid "Unpaid" +#~ msgstr "未付款" diff --git a/accounting/models.py b/accounting/models.py index bde0174..665e5f3 100644 --- a/accounting/models.py +++ b/accounting/models.py @@ -21,6 +21,7 @@ from dirtyfields import DirtyFieldsMixin from django.conf import settings from django.db import models +from django.db.models import Sum, Case, When, F, Q from django.urls import reverse from mia_core.utils import get_multi_lingual_attr, set_multi_lingual_attr @@ -322,8 +323,9 @@ class Record(DirtyFieldsMixin, models.Model): self.balance = None self._is_balanced = None self._has_order_hole = None - self._is_credit_card_paid = None + self._is_payable = None self._is_existing_equipment = None + self.is_payable = False def __str__(self): """Returns the string representation of this accounting @@ -382,17 +384,6 @@ class Record(DirtyFieldsMixin, models.Model): def has_order_hole(self, value): self._has_order_hole = value - @property - def is_credit_card_paid(self): - # TODO: To be done - if self._is_credit_card_paid is None: - self._is_credit_card_paid = True - return self._is_credit_card_paid - - @is_credit_card_paid.setter - def is_credit_card_paid(self, value): - self._is_credit_card_paid = value - @property def is_existing_equipment(self): # TODO: To be done diff --git a/accounting/templates/accounting/ledger.html b/accounting/templates/accounting/ledger.html index 31fd812..8ce8af4 100644 --- a/accounting/templates/accounting/ledger.html +++ b/accounting/templates/accounting/ledger.html @@ -96,7 +96,7 @@ First written: 2020/7/16 {% for item in item_list %} - + {{ item.transaction.date|smart_date }} {{ item.account.title|title_case }} {{ item.summary|default:"" }}{% if not item.is_balanced %} @@ -107,9 +107,9 @@ First written: 2020/7/16 {{ _("Need Reorder")|force_escape }} - {% endif %}{% if not item.is_credit_card_paid %} + {% endif %}{% if item.is_payable %} - {{ _("Unpaid")|force_escape }} + {{ _("Payable")|force_escape }} {% endif %}{% if item.is_existing_equipment %} @@ -135,7 +135,7 @@ First written: 2020/7/16 {# The list for small screens #}