Renamed "subject" to "account" in the models of the accounting application.
This commit is contained in:
parent
076a68c028
commit
bace7bb93b
@ -68,7 +68,7 @@ class Account(models.Model):
|
|||||||
self._title = value
|
self._title = value
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = "accounting_subjects"
|
db_table = "accounting_accounts"
|
||||||
ordering = ["code"]
|
ordering = ["code"]
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ class Record(models.Model):
|
|||||||
is_credit = models.BooleanField()
|
is_credit = models.BooleanField()
|
||||||
ord = models.PositiveSmallIntegerField(default=1)
|
ord = models.PositiveSmallIntegerField(default=1)
|
||||||
account = models.ForeignKey(
|
account = models.ForeignKey(
|
||||||
Account, on_delete=models.PROTECT, db_column="subject_sn")
|
Account, on_delete=models.PROTECT, db_column="account_sn")
|
||||||
summary = models.CharField(max_length=128, blank=True, null=True)
|
summary = models.CharField(max_length=128, blank=True, null=True)
|
||||||
amount = models.PositiveIntegerField()
|
amount = models.PositiveIntegerField()
|
||||||
created_at = models.DateTimeField(
|
created_at = models.DateTimeField(
|
||||||
|
@ -865,12 +865,12 @@ def _ledger_accounts():
|
|||||||
"""
|
"""
|
||||||
# TODO: Te be replaced with the Django model queries
|
# TODO: Te be replaced with the Django model queries
|
||||||
return list(Account.objects.raw("""SELECT s.*
|
return list(Account.objects.raw("""SELECT s.*
|
||||||
FROM accounting_subjects AS s
|
FROM accounting_accounts AS s
|
||||||
WHERE s.code IN (SELECT s.code
|
WHERE s.code IN (SELECT s.code
|
||||||
FROM accounting_subjects AS s
|
FROM accounting_accounts AS s
|
||||||
INNER JOIN (SELECT s.code
|
INNER JOIN (SELECT s.code
|
||||||
FROM accounting_subjects AS s
|
FROM accounting_accounts AS s
|
||||||
INNER JOIN accounting_records AS r ON r.subject_sn = s.sn
|
INNER JOIN accounting_records AS r ON r.account_sn = s.sn
|
||||||
GROUP BY s.code) AS u
|
GROUP BY s.code) AS u
|
||||||
ON u.code LIKE s.code || '%'
|
ON u.code LIKE s.code || '%'
|
||||||
GROUP BY s.code)
|
GROUP BY s.code)
|
||||||
|
Loading…
Reference in New Issue
Block a user