diff --git a/accounting/admin.py b/accounting/admin.py index 1000d19..3ed3a86 100644 --- a/accounting/admin.py +++ b/accounting/admin.py @@ -1,8 +1,8 @@ from django.contrib import admin # Register your models here. -from .models import Subject, Transaction, Record +from .models import Account, Transaction, Record -admin.site.register(Subject) +admin.site.register(Account) admin.site.register(Transaction) admin.site.register(Record) diff --git a/accounting/models.py b/accounting/models.py index e756323..a6ca852 100644 --- a/accounting/models.py +++ b/accounting/models.py @@ -26,8 +26,8 @@ from mia_core.templatetags.mia_core import smart_month from mia_core.utils import get_multi_lingual_attr -class Subject(models.Model): - """An accounting subject.""" +class Account(models.Model): + """An account.""" sn = models.PositiveIntegerField(primary_key=True) parent = models.ForeignKey( "self", on_delete=models.PROTECT, null=True, blank=True, @@ -43,17 +43,16 @@ class Subject(models.Model): created_by = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.PROTECT, db_column="createdby", - related_name="created_accounting_subjects") + related_name="created_accounting_accounts") updated_at = models.DateTimeField( auto_now_add=True, db_column="updated") updated_by = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.PROTECT, db_column="updatedby", - related_name="updated_accounting_subjects") + related_name="updated_accounting_accounts") def __str__(self): - """Returns the string representation of this accounting - subject.""" + """Returns the string representation of this account.""" return self.code.__str__() + " " + self.title _title = None @@ -155,7 +154,7 @@ class Transaction(models.Model): """Whether this transaction is a cash income transaction.""" debit_records = self.debit_records return (len(debit_records) == 1 - and debit_records[0].subject.code == "1111" + and debit_records[0].account.code == "1111" and debit_records[0].summary is None) @property @@ -163,7 +162,7 @@ class Transaction(models.Model): """Whether this transaction is a cash expense transaction.""" credit_records = self.credit_records return (len(credit_records) == 1 - and credit_records[0].subject.code == "1111" + and credit_records[0].account.code == "1111" and credit_records[0].summary is None) def get_absolute_url(self): @@ -199,8 +198,8 @@ class Record(models.Model): db_column="transaction_sn") is_credit = models.BooleanField() ord = models.PositiveSmallIntegerField(default=1) - subject = models.ForeignKey( - Subject, on_delete=models.PROTECT, db_column="subject_sn") + account = models.ForeignKey( + Account, on_delete=models.PROTECT, db_column="subject_sn") summary = models.CharField(max_length=128, blank=True, null=True) amount = models.PositiveIntegerField() created_at = models.DateTimeField( @@ -310,7 +309,7 @@ class Record(models.Model): record.""" return "%s %s %s %s" % ( self.transaction.date, - self.subject.title, + self.account.title, self.summary, self.amount) diff --git a/accounting/static/accounting/css/report.css b/accounting/static/accounting/css/report.css index 5861d6c..076f0fd 100644 --- a/accounting/static/accounting/css/report.css +++ b/accounting/static/accounting/css/report.css @@ -22,12 +22,12 @@ */ -.subject-picker { +.account-picker { height: auto; max-height: 400px; overflow-x: hidden; } -.date-subject-line { +.date-account-line { font-size: 0.833em; } .negative { @@ -100,7 +100,7 @@ .income-statement-table tr { height: 50px; } -.income-statement-table td .subject { +.income-statement-table td .account { text-indent: 2em; } .income-statement-table tr.section-title { @@ -156,7 +156,7 @@ font-size: 1.1em; font-weight: bolder; } -.balance-sheet-table td .subject { +.balance-sheet-table td .account { text-indent: 1em; } .balance-sheet-table .total { diff --git a/accounting/templates/accounting/balance-sheet.html b/accounting/templates/accounting/balance-sheet.html index 0aaf329..ab3a695 100644 --- a/accounting/templates/accounting/balance-sheet.html +++ b/accounting/templates/accounting/balance-sheet.html @@ -97,7 +97,7 @@ First written: 2020/7/20 {% for item in group.details %} -
{{ item.title|title }}
+
{{ item.title|title }}
{{ item.balance|accounting_amount }} @@ -128,7 +128,7 @@ First written: 2020/7/20 {% for item in group.details %} -
{{ item.title|title }}
+
{{ item.title|title }}
{{ item.balance|accounting_amount }}
@@ -165,7 +165,7 @@ First written: 2020/7/20 {% for item in group.details %} -
{{ item.title|title }}
+
{{ item.title|title }}
{{ item.balance|accounting_amount }}
@@ -235,7 +235,7 @@ First written: 2020/7/20 {{ group.title|title }} {% for item in group.details %} -
  • +
  • {{ item.title|title }}
    @@ -266,7 +266,7 @@ First written: 2020/7/20 {{ group.title|title }}
  • {% for item in group.details %} -
  • +
  • {{ item.title|title }}
    @@ -295,8 +295,8 @@ First written: 2020/7/20 {{ group.title|title }}
  • {% for item in group.details %} -
  • - {# TODO: Link to the income statement for subject #3353 #} +
  • + {# TODO: Link to the income statement for account #3353 #} {{ item.title|title }}
    diff --git a/accounting/templates/accounting/cash-summary.html b/accounting/templates/accounting/cash-summary.html index 68bf4c3..443d7dc 100644 --- a/accounting/templates/accounting/cash-summary.html +++ b/accounting/templates/accounting/cash-summary.html @@ -27,7 +27,7 @@ First written: 2020/7/15 {% load accounting %} {% block settings %} - {% blocktrans asvar title with subject=current_subject.title|title context "Accounting|" %}Cash Summary for {{ subject }}{% endblocktrans %} + {% blocktrans asvar title with account=current_account.title|title context "Accounting|" %}Cash Summary for {{ account }}{% endblocktrans %} {% setvar "title" title %} {% static "accounting/css/report.css" as css %} {% setvar "css" css %} @@ -66,20 +66,20 @@ First written: 2020/7/15 {% endwith %}
  • {% if item.month is not None %} - + {{ item.label }}
    diff --git a/accounting/templates/accounting/cash.html b/accounting/templates/accounting/cash.html index 4b69a73..cbefa9f 100644 --- a/accounting/templates/accounting/cash.html +++ b/accounting/templates/accounting/cash.html @@ -27,7 +27,7 @@ First written: 2020/7/1 {% load accounting %} {% block settings %} - {% blocktrans asvar title with subject=current_subject.title|title period=period.description context "Accounting|" %}Cash Account for {{ subject }} in {{ period }}{% endblocktrans %} + {% blocktrans asvar title with account=current_account.title|title period=period.description context "Accounting|" %}Cash Account for {{ account }} in {{ period }}{% endblocktrans %} {% setvar "title" title %} {% setvar "use_period_chooser" True %} {% static "accounting/css/report.css" as css %} @@ -67,20 +67,20 @@ First written: 2020/7/1 {% endwith %}
    -
  • {% if item.sn is not None %} -
    - {{ item.transaction.date|smart_date }} {{ item.subject.title|title }} +
    @@ -185,8 +185,8 @@ First written: 2020/7/1
    {% else %} -
    - {{ item.transaction.date|smart_date }} {{ item.subject.title }} +
    {{ item.summary|default:"" }}
    diff --git a/accounting/templates/accounting/include/report-chooser.html b/accounting/templates/accounting/include/report-chooser.html index 35b3e71..9cfd120 100644 --- a/accounting/templates/accounting/include/report-chooser.html +++ b/accounting/templates/accounting/include/report-chooser.html @@ -62,7 +62,7 @@ First written: 2020/7/9 {% trans "Book" context "Accounting|" as text %}{{ text|force_escape }} -
  • {% for item in group.details %} -
  • +
  • {{ item.title|title }}
    diff --git a/accounting/templates/accounting/journal.html b/accounting/templates/accounting/journal.html index 7b4887c..90d167c 100644 --- a/accounting/templates/accounting/journal.html +++ b/accounting/templates/accounting/journal.html @@ -82,7 +82,7 @@ First written: 2020/7/17 {% trans "Date" context "Accounting|" as text %}{{ text|force_escape }} - {% trans "Subject" context "Accounting|" as text %}{{ text|force_escape }} + {% trans "Account" context "Accounting|" as text %}{{ text|force_escape }} {% trans "Summary" context "Accounting|" as text %}{{ text|force_escape }} {% trans "Debit" context "Accounting|" as text %}{{ text|force_escape }} {% trans "Credit" context "Accounting|" as text %}{{ text|force_escape }} @@ -94,7 +94,7 @@ First written: 2020/7/17 {% for item in item_list %} {{ item.transaction.date|smart_date }} - {{ item.subject.title|title }} + {{ item.account.title|title }}
    {{ item.summary|default:"" }}{% if not item.is_balanced %} {% trans "Unbalanced" context "Accounting|" as text %} @@ -129,8 +129,8 @@ First written: 2020/7/17 {% if item.sn is not None %}
    -
    - {{ item.transaction.date|smart_date }} {{ item.subject.title|title }} +
    @@ -166,8 +166,8 @@ First written: 2020/7/17 {% else %}
    -
    - {{ item.transaction.date|smart_date }} {{ item.subject.title|title }} +
    diff --git a/accounting/templates/accounting/ledger-summary.html b/accounting/templates/accounting/ledger-summary.html index 17df6df..e39462c 100644 --- a/accounting/templates/accounting/ledger-summary.html +++ b/accounting/templates/accounting/ledger-summary.html @@ -27,7 +27,7 @@ First written: 2020/7/16 {% load accounting %} {% block settings %} - {% blocktrans asvar title with subject=current_subject.title|title context "Accounting|" %}Ledger Summary for {{ subject }}{% endblocktrans %} + {% blocktrans asvar title with account=current_account.title|title context "Accounting|" %}Ledger Summary for {{ account }}{% endblocktrans %} {% setvar "title" title %} {% static "accounting/css/report.css" as css %} {% setvar "css" css %} @@ -66,13 +66,13 @@ First written: 2020/7/16 {% endwith %}
    -