django-ledger 0.7.3__py3-none-any.whl → 0.7.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of django-ledger might be problematic. Click here for more details.

Files changed (42) hide show
  1. django_ledger/__init__.py +1 -1
  2. django_ledger/contrib/django_ledger_graphene/journal_entry/schema.py +2 -3
  3. django_ledger/contrib/django_ledger_graphene/transaction/schema.py +9 -7
  4. django_ledger/forms/journal_entry.py +19 -12
  5. django_ledger/forms/transactions.py +8 -12
  6. django_ledger/io/io_core.py +14 -11
  7. django_ledger/io/io_library.py +3 -3
  8. django_ledger/migrations/0001_initial.py +1 -1
  9. django_ledger/migrations/0019_alter_transactionmodel_amount_and_more.py +33 -0
  10. django_ledger/models/bill.py +17 -2
  11. django_ledger/models/chart_of_accounts.py +4 -0
  12. django_ledger/models/closing_entry.py +8 -6
  13. django_ledger/models/invoice.py +12 -4
  14. django_ledger/models/journal_entry.py +843 -481
  15. django_ledger/models/ledger.py +45 -4
  16. django_ledger/models/transactions.py +303 -305
  17. django_ledger/models/unit.py +42 -22
  18. django_ledger/templates/django_ledger/account/tags/accounts_table.html +1 -1
  19. django_ledger/templates/django_ledger/bills/bill_detail.html +1 -1
  20. django_ledger/templates/django_ledger/invoice/invoice_detail.html +1 -1
  21. django_ledger/templates/django_ledger/journal_entry/je_create.html +2 -3
  22. django_ledger/templates/django_ledger/journal_entry/je_delete.html +2 -3
  23. django_ledger/templates/django_ledger/journal_entry/je_detail.html +1 -1
  24. django_ledger/templates/django_ledger/journal_entry/je_detail_txs.html +8 -8
  25. django_ledger/templates/django_ledger/journal_entry/je_list.html +16 -13
  26. django_ledger/templates/django_ledger/journal_entry/je_update.html +2 -3
  27. django_ledger/templates/django_ledger/journal_entry/tags/je_table.html +24 -24
  28. django_ledger/templates/django_ledger/journal_entry/tags/je_txs_table.html +17 -14
  29. django_ledger/templates/django_ledger/ledger/tags/ledgers_table.html +38 -37
  30. django_ledger/templates/django_ledger/transactions/tags/txs_table.html +69 -0
  31. django_ledger/templatetags/django_ledger.py +25 -45
  32. django_ledger/urls/account.py +4 -4
  33. django_ledger/views/account.py +7 -7
  34. django_ledger/views/journal_entry.py +84 -101
  35. django_ledger/views/ledger.py +16 -21
  36. django_ledger/views/mixins.py +11 -10
  37. {django_ledger-0.7.3.dist-info → django_ledger-0.7.4.1.dist-info}/METADATA +8 -3
  38. {django_ledger-0.7.3.dist-info → django_ledger-0.7.4.1.dist-info}/RECORD +42 -40
  39. {django_ledger-0.7.3.dist-info → django_ledger-0.7.4.1.dist-info}/AUTHORS.md +0 -0
  40. {django_ledger-0.7.3.dist-info → django_ledger-0.7.4.1.dist-info}/LICENSE +0 -0
  41. {django_ledger-0.7.3.dist-info → django_ledger-0.7.4.1.dist-info}/WHEEL +0 -0
  42. {django_ledger-0.7.3.dist-info → django_ledger-0.7.4.1.dist-info}/top_level.txt +0 -0
@@ -2,20 +2,23 @@
2
2
  Django Ledger created by Miguel Sanda <msanda@arrobalytics.com>.
3
3
  Copyright© EDMA Group Inc licensed under the GPLv3 Agreement.
4
4
 
5
- An EntityUnit is a logical, user-defined grouping which is assigned to JournalEntryModels to help segregate business
6
- operations into separate components. Examples of business units may include Departments (i.e. Human Resources, IT, etc.)
7
- office locations, a real estate property, or any other label relevant to the business.
8
-
9
- An EntityUnit is self contained. Meaning that double entry accounting rules apply to all transactions associated within
10
- them. When An Invoice or Bill is updated, the migration process generates the appropriate Journal Entries associated
11
- with each unit, if any. This means that an invoice or bill can split items into different units and the migration
12
- process will allocate costs to each unit accordingly.
13
-
14
- The main advantages of EntityUnits are:
15
- 1. Entity units can generate their own financial statements which can give additional insight to specific operations
16
- of the business.
17
- 2. Entity units can be assigned to specific items on Bills and Invoices, providing additional flexibility to track
18
- inventory, expenses or income attributable to specific units of the business.
5
+ An EntityUnit is a logical, user-defined grouping assigned to JournalEntryModels,
6
+ helping to segregate business operations into distinct components. Examples of
7
+ EntityUnits may include departments (e.g., Human Resources, IT), office locations,
8
+ real estate properties, or any other labels relevant to the business.
9
+
10
+ EntityUnits are self-contained entities, meaning that double-entry accounting rules
11
+ apply to all transactions associated with them. When an Invoice or Bill is updated,
12
+ the migration process generates the corresponding Journal Entries for each relevant
13
+ unit. This allows invoices or bills to split specific items into different units,
14
+ with the migration process allocating costs to each unit accordingly.
15
+
16
+ Key advantages of EntityUnits:
17
+ 1. EntityUnits can generate their own financial statements, providing deeper
18
+ insights into the specific operations of the business.
19
+ 2. EntityUnits can be assigned to specific items on Bills and Invoices, offering
20
+ flexibility to track inventory, expenses, or income associated with distinct
21
+ business units.
19
22
  """
20
23
 
21
24
  from random import choices
@@ -25,7 +28,7 @@ from uuid import uuid4
25
28
 
26
29
  from django.core.exceptions import ValidationError
27
30
  from django.db import models
28
- from django.db.models import Q
31
+ from django.db.models import Q, F
29
32
  from django.urls import reverse
30
33
  from django.utils.text import slugify
31
34
  from django.utils.translation import gettext_lazy as _
@@ -50,6 +53,13 @@ class EntityUnitModelQuerySet(MP_NodeQuerySet):
50
53
 
51
54
  class EntityUnitModelManager(MP_NodeManager):
52
55
 
56
+ def get_queryset(self):
57
+ qs = EntityUnitModelQuerySet(self.model, using=self._db)
58
+ return qs.annotate(
59
+ _entity_slug=F('entity__slug'),
60
+ _entity_name=F('entity__name'),
61
+ )
62
+
53
63
  def for_user(self, user_model):
54
64
  qs = self.get_queryset()
55
65
  if user_model.is_superuser:
@@ -71,12 +81,6 @@ class EntityUnitModelManager(MP_NodeManager):
71
81
  user_model
72
82
  Logged in and authenticated django UserModel instance.
73
83
 
74
- Examples
75
- --------
76
- >>> request_user = request.user
77
- >>> slug = kwargs['entity_slug'] # may come from request kwargs
78
- >>> bill_model_qs = EntityUnitModel.objects.for_entity(user_model=request_user, entity_slug=slug)
79
-
80
84
  Returns
81
85
  -------
82
86
  EntityUnitModelQuerySet
@@ -149,7 +153,23 @@ class EntityUnitModelAbstract(MP_Node,
149
153
  ]
150
154
 
151
155
  def __str__(self):
152
- return f'Unit: {self.name}'
156
+ return f'{self.entity_name}: {self.name}'
157
+
158
+ @property
159
+ def entity_slug(self):
160
+ try:
161
+ return getattr(self, '_entity_slug')
162
+ except AttributeError:
163
+ pass
164
+ return self.entity.slug
165
+
166
+ @property
167
+ def entity_name(self):
168
+ try:
169
+ return getattr(self, '_entity_name')
170
+ except AttributeError:
171
+ pass
172
+ return self.entity.name
153
173
 
154
174
  def clean(self):
155
175
  self.create_entity_unit_slug()
@@ -87,7 +87,7 @@
87
87
  <td>
88
88
  <div class="dropdown is-right is-hoverable" id="account-action-{{ account.uuid }}">
89
89
  <div class="dropdown-trigger">
90
- <button class="button is-small is-rounded is-outlined"
90
+ <button class="button is-small is-rounded"
91
91
  aria-haspopup="true"
92
92
  aria-controls="dropdown-menu">
93
93
  <span>{% trans 'Actions' %}</span>
@@ -172,7 +172,7 @@
172
172
  </h2>
173
173
  </div>
174
174
  <div class="card-content">
175
- {% bill_txs_table bill %}
175
+ {% transactions_table bill %}
176
176
  </div>
177
177
  </div>
178
178
  </div>
@@ -158,7 +158,7 @@
158
158
  </h2>
159
159
  </div>
160
160
  <div class="card-content">
161
- {% invoice_txs_table invoice %}
161
+ {% transactions_table invoice %}
162
162
  </div>
163
163
  </div>
164
164
  </div>
@@ -10,14 +10,13 @@
10
10
  </div>
11
11
  <div class="column is-4">
12
12
  <div class="box">
13
- <form method="post"
14
- action="{% url 'django_ledger:je-create' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk %}">
13
+ <form method="post">
15
14
  {% csrf_token %}
16
15
  {{ form.as_p }}
17
16
  <button class="button is-outlined is-primary is-fullwidth djetler_my_1" type="submit">Create
18
17
  </button>
19
18
  <a class="button is-small is-dark is-fullwidth"
20
- href="{% url 'django_ledger:je-list' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk %}">Back</a>
19
+ href="{{ ledger_model.get_journal_entry_list_url }}">Back</a>
21
20
  </form>
22
21
  </div>
23
22
  </div>
@@ -6,15 +6,14 @@
6
6
  {% block view_content %}
7
7
  <div class="columns is-centered">
8
8
  <div class="column is-6">
9
- <form action="{% url 'django_ledger:je-delete' entity_slug=view.kwargs.entity_slug ledger_pk=je_model.ledger_id je_pk=je_model.uuid %}"
10
- method="post">
9
+ <form method="post">
11
10
  {% csrf_token %}
12
11
  <div class="card">
13
12
  <div class="card-content has-text-centered">
14
13
  <p class="title has-text-weight-light">{{ je_model.get_delete_message }}</p>
15
14
  </div>
16
15
  <div class="card-content has-text-centered">
17
- <a href="{% url 'django_ledger:home' %}"
16
+ <a href="{{ je_model.get_journal_entry_list_url }}"
18
17
  class="button is-primary">{% trans 'Go Back' %}</a>
19
18
  <button type="submit" class="button is-danger">{% trans 'Delete' %}</button>
20
19
  </div>
@@ -14,7 +14,7 @@
14
14
  <div class="card-header-title">{% trans 'Journal Entry Transactions' %}</div>
15
15
  </div>
16
16
  <div class="card-content">
17
- {% journal_entry_txs_table journal_entry %}
17
+ {% transactions_table journal_entry %}
18
18
  <a class="button is-primary is-outlined"
19
19
  href="{% url 'django_ledger:je-detail-txs' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk je_pk=journal_entry.uuid %}">
20
20
  {% trans 'Edit TXS' %}
@@ -55,31 +55,31 @@
55
55
  {% trans 'Save' %}
56
56
  </button>
57
57
  <a class="button is-dark"
58
- href="{% url "django_ledger:je-list" entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk %}">
58
+ href="{{ journal_entry.get_journal_entry_list_url }}?next={{ request.path }}">
59
59
  {% trans 'Done' %}
60
60
  </a>
61
61
  {% if journal_entry.can_lock %}
62
62
  <a class="button is-dark is-danger"
63
- href="{% url "django_ledger:je-mark-as-locked" entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk je_pk=journal_entry.uuid %}">
63
+ href="{{ journal_entry.get_action_lock_url }}?next={{ request.path }}">
64
64
  {% trans 'Lock' %}
65
65
  </a>
66
66
  {% endif %}
67
67
  {% if journal_entry.can_unlock %}
68
68
  <a class="button is-dark is-warning"
69
- href="{% url "django_ledger:je-mark-as-unlocked" entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk je_pk=journal_entry.uuid %}">
70
- {% trans 'Lock' %}
69
+ href="{{ journal_entry.get_action_unlock_url }}?next={{ request.path }}">
70
+ {% trans 'UnLock' %}
71
71
  </a>
72
72
  {% endif %}
73
73
  {% if journal_entry.can_post %}
74
74
  <a class="button is-dark is-danger"
75
- href="{% url "django_ledger:je-mark-as-posted" entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk je_pk=journal_entry.uuid %}">
76
- {% trans 'Lock' %}
75
+ href="{{ journal_entry.get_action_post_url }}?next={{ request.path }}">
76
+ {% trans 'Post' %}
77
77
  </a>
78
78
  {% endif %}
79
79
  {% if journal_entry.can_unpost %}
80
80
  <a class="button is-warning"
81
- href="{% url "django_ledger:je-mark-as-unposted" entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk je_pk=journal_entry.uuid %}">
82
- {% trans 'Lock' %}
81
+ href="{{ journal_entry.get_action_unpost_url }}?next={{ request.path }}">
82
+ {% trans 'UnPost' %}
83
83
  </a>
84
84
  {% endif %}
85
85
  </div>
@@ -4,9 +4,7 @@
4
4
  {% load django_ledger %}
5
5
 
6
6
  {% block view_content %}
7
-
8
- {# {% include 'django_ledger/journal_entry/includes/card_journal_entry.html' je_model= %}#}
9
-
7
+
10
8
  <div class="card">
11
9
  <div class="card-content">
12
10
  <div class="level">
@@ -21,10 +19,15 @@
21
19
  <h1 class="is-size-1 has-text-weight-thin">{% trans 'Journal Entries' %}</h1>
22
20
  {% endif %}
23
21
  </div>
24
- <div class="level-item">
25
- <a href="{% url 'django_ledger:je-create' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk %}">
26
- <span class="icon is-large has-text-success">{% icon 'carbon:add-alt' 60 %}</span></a>
27
- </div>
22
+
23
+ {# Do not show + button if ledger is locked #}
24
+ {% if not ledger_model.is_locked %}
25
+ <div class="level-item">
26
+ <a href="{{ ledger_model.get_journal_entry_create_url }}">
27
+ <span class="icon is-large has-text-success">{% icon 'carbon:add-alt' 60 %}</span></a>
28
+ </div>
29
+ {% endif %}
30
+
28
31
  </div>
29
32
  <div class="level-right">
30
33
  {% if previous_month %}
@@ -88,12 +91,12 @@
88
91
  </div>
89
92
  </div>
90
93
 
91
- {% jes_table journal_entry_list %}
94
+ {% jes_table journal_entry_qs %}
92
95
 
93
96
  {% if year %}
94
97
  <h5 class="is-size-5">{% trans 'Go to month:' %}</h5>
95
98
  <p>
96
- <a href="{% url 'django_ledger:je-list' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk %}">
99
+ <a href="{{ ledger_model.get_journal_entry_list_url }}">
97
100
  {% trans 'All' %} |
98
101
  </a>
99
102
  {% for date in date_list %}
@@ -105,7 +108,7 @@
105
108
  {% else %}
106
109
  <h5 class="is-size-5">{% trans 'Go to year:' %}</h5>
107
110
  <p>
108
- <a href="{% url 'django_ledger:je-list' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk %}">
111
+ <a href="{{ ledger_model.get_journal_entry_list_url }}">
109
112
  {% trans 'All' %} |
110
113
  </a>
111
114
  {% for date in date_list %}
@@ -119,17 +122,17 @@
119
122
  <div class="columns is-centered">
120
123
  <div class="column is-3">
121
124
  <a class="button is-dark is-fullwidth"
122
- href="{% url 'django_ledger:ledger-list' entity_slug=view.kwargs.entity_slug %}">
125
+ href="{{ ledger_model.get_list_url }}">
123
126
  {% trans 'Back to Ledger List' %}</a>
124
127
  </div>
125
128
  <div class="column is-3">
126
129
  <a class="button is-success is-fullwidth"
127
- href="{% url 'django_ledger:ledger-action-lock-journal-entries' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk %}">
130
+ href="{{ ledger_model.get_action_lock_journal_entries_url }}">
128
131
  {% trans 'Lock All' %}</a>
129
132
  </div>
130
133
  <div class="column is-3">
131
134
  <a class="button is-warning is-fullwidth"
132
- href="{% url 'django_ledger:ledger-action-post-journal-entries' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk %}">
135
+ href="{{ ledger_model.get_action_post_journal_entries_url }}">
133
136
  {% trans 'Post All' %}</a>
134
137
  </div>
135
138
  </div>
@@ -6,13 +6,12 @@
6
6
  <div class="columns is-centered">
7
7
  <div class="column is-6">
8
8
  <div class="box">
9
- <form method="post"
10
- action="{% url 'django_ledger:je-update' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk je_pk=journal_entry.uuid %}">
9
+ <form method="post">
11
10
  {% csrf_token %}
12
11
  {{ form.as_p }}
13
12
  <button class="button is-fullwidth is-primary is-outlined djetler_my_1" type="submit">Update
14
13
  </button>
15
- <a href="{% url 'django_ledger:je-list' entity_slug=view.kwargs.entity_slug ledger_pk=view.kwargs.ledger_pk %}"
14
+ <a href="{{ journal_entry.get_journal_entry_list_url }}"
16
15
  class="button is-small is-dark is-fullwidth">Back</a>
17
16
  </form>
18
17
  </div>
@@ -17,21 +17,21 @@
17
17
  </tr>
18
18
  </thead>
19
19
  <tbody>
20
- {% for je in jes %}
20
+ {% for journal_entry_model in journal_entry_qs %}
21
21
  <tr class="has-text-centered">
22
- <td>{{ je.je_number }}</td>
23
- <td>{{ je.timestamp }}</td>
24
- <td>{% if je.activity %}{{ je.get_activity_display }}{% endif %}</td>
25
- <td>{% if je.description %}{{ je.description }}{% endif %}</td>
22
+ <td>{{ journal_entry_model.je_number }}</td>
23
+ <td>{{ journal_entry_model.timestamp }}</td>
24
+ <td>{% if journal_entry_model.activity %}{{ journal_entry_model.get_activity_display }}{% endif %}</td>
25
+ <td>{% if journal_entry_model.description %}{{ journal_entry_model.description }}{% endif %}</td>
26
26
  <td>
27
- {% if je.is_posted %}
27
+ {% if journal_entry_model.is_posted %}
28
28
  <span class="icon has-text-success">{% icon 'ant-design:check-circle-filled' 24 %}</span>
29
29
  {% else %}
30
30
  <span class="icon is-small has-text-danger">{% icon 'maki:roadblock-11' 24 %}</span>
31
31
  {% endif %}
32
32
  </td>
33
33
  <td>
34
- {% if je.is_locked %}
34
+ {% if journal_entry_model.is_locked %}
35
35
  <span class="icon has-text-success-dark">
36
36
  {% icon 'bi:lock-fill' 24 %}
37
37
  </span>
@@ -41,11 +41,11 @@
41
41
  </span>
42
42
  {% endif %}
43
43
  </td>
44
- <td>{{ je.get_entity_unit_name }}</td>
45
- <td class="has-text-weight-bold">{{ je.txs_count }}</td>
44
+ <td>{{ journal_entry_model.get_entity_unit_name }}</td>
45
+ <td class="has-text-weight-bold">{{ journal_entry_model.txs_count }}</td>
46
46
  <td>
47
47
  <div class="dropdown is-right is-hoverable"
48
- id="je-action-{{ je.uuid }}">
48
+ id="je-action-{{ journal_entry_model.uuid }}">
49
49
  <div class="dropdown-trigger">
50
50
  <button class="button is-small is-rounded is-outlined is-dark"
51
51
  aria-haspopup="true"
@@ -58,37 +58,37 @@
58
58
  </div>
59
59
 
60
60
  <div class="dropdown-menu"
61
- id="dropdown-menu-{{ je.uuid }}"
61
+ id="dropdown-menu-{{ journal_entry_model.uuid }}"
62
62
  role="menu">
63
63
  <div class="dropdown-content">
64
- {% if je.can_post %}
64
+ {% if journal_entry_model.can_post %}
65
65
  <a class="dropdown-item"
66
- href="{% url 'django_ledger:je-mark-as-posted' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=je.uuid %}?next={{ next_url }}">
66
+ href="{{ journal_entry_model.get_action_post_url }}?next={{ next_url }}">
67
67
  {% trans 'Post' %}</a>
68
- {% elif je.can_unpost %}
68
+ {% elif journal_entry_model.can_unpost %}
69
69
  <a class="dropdown-item"
70
- href="{% url 'django_ledger:je-mark-as-unposted' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=je.uuid %}?next={{ next_url }}">
70
+ href="{{ journal_entry_model.get_action_unpost_url }}?next={{ next_url }}">
71
71
  {% trans 'UnPost' %}</a>
72
72
  {% endif %}
73
- {% if je.can_lock %}
73
+ {% if journal_entry_model.can_lock %}
74
74
  <a class="dropdown-item"
75
- href="{% url 'django_ledger:je-mark-as-locked' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=je.uuid %}?next={{ next_url }}">
75
+ href="{{ journal_entry_model.get_action_lock_url }}?next={{ next_url }}">
76
76
  {% trans 'Lock' %}</a>
77
- {% elif je.can_unlock %}
77
+ {% elif journal_entry_model.can_unlock %}
78
78
  <a class="dropdown-item"
79
- href="{% url 'django_ledger:je-mark-as-unlocked' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=je.uuid %}?next={{ next_url }}">
79
+ href="{{ journal_entry_model.get_action_unlock_url }}?next={{ next_url }}">
80
80
  {% trans 'Unlock' %}</a>
81
81
  {% endif %}
82
82
  <a class="dropdown-item"
83
- href="{% url 'django_ledger:je-update' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=je.uuid %}">{% trans 'Edit' %}</a>
83
+ href="{% url 'django_ledger:je-update' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=journal_entry_model.uuid %}">{% trans 'Edit' %}</a>
84
84
  <a class="dropdown-item"
85
- href="{% url 'django_ledger:je-detail' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=je.uuid %}">{% trans 'View' %}</a>
86
- {% if je.can_delete %}
85
+ href="{% url 'django_ledger:je-detail' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=journal_entry_model.uuid %}">{% trans 'View' %}</a>
86
+ {% if journal_entry_model.can_delete %}
87
87
  <a class="dropdown-item has-text-danger has-text-weight-bold"
88
- href="{% url 'django_ledger:je-delete' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=je.uuid %}">{% trans 'Delete' %}</a>
88
+ href="{% url 'django_ledger:je-delete' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=journal_entry_model.uuid %}">{% trans 'Delete' %}</a>
89
89
  {% endif %}
90
90
  <a class="dropdown-item"
91
- href="{% url 'django_ledger:je-detail-txs' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=je.uuid %}">{% trans 'Transactions' %}</a>
91
+ href="{% url 'django_ledger:je-detail-txs' entity_slug=entity_slug ledger_pk=ledger_pk je_pk=journal_entry_model.uuid %}">{% trans 'Transactions' %}</a>
92
92
  </div>
93
93
  </div>
94
94
  </div>
@@ -13,15 +13,18 @@
13
13
  <th>{% trans 'Debit' %}</th>
14
14
  <th>{% trans 'Description' %}</th>
15
15
  </tr>
16
- {% for tx in txs %}
16
+ {% for transaction_model in transaction_model_qs %}
17
17
  <tr>
18
- <td>{{ tx.journal_entry.timestamp }}</td>
19
- <td>{{ tx.account.code }}</td>
20
- <td>{{ tx.account.name }}</td>
21
- <td>{% if tx.journal_entry.entity_unit %}{{ tx.journal_entry.entity_unit.name }}{% endif %}</td>
22
- <td>{% if tx.tx_type == 'credit' %}${{ tx.amount | currency_format }}{% endif %}</td>
23
- <td>{% if tx.tx_type == 'debit' %}${{ tx.amount | currency_format }}{% endif %}</td>
24
- <td>{% if tx.description %}{{ tx.description }}{% endif %}</td>
18
+ <td>{{ transaction_model.timestamp }}</td>
19
+ <td>{{ transaction_model.account_code }}</td>
20
+ <td>{{ transaction_model.account_name }}</td>
21
+ <td>{% if transaction_model.entity_unit_name %}
22
+ {{ transaction_model.entity_unit_name }}{% endif %}</td>
23
+ <td>{% if transaction_model.is_credit %}$
24
+ {{ transaction_model.amount | currency_format }}{% endif %}</td>
25
+ <td>{% if transaction_model.is_debit %}$
26
+ {{ transaction_model.amount | currency_format }}{% endif %}</td>
27
+ <td>{% if transaction_model.description %}{{ transaction_model.description }}{% endif %}</td>
25
28
  </tr>
26
29
  {% endfor %}
27
30
  <tr class="has-text-weight-bold">
@@ -45,13 +48,13 @@
45
48
  <th>{% trans 'Debit' %}</th>
46
49
  <th>{% trans 'Description' %}</th>
47
50
  </tr>
48
- {% for tx in txs %}
51
+ {% for transaction_model in transaction_model_qs %}
49
52
  <tr>
50
- <td>{{ tx.account.code }}</td>
51
- <td>{{ tx.account.name }}</td>
52
- <td>{% if tx.tx_type == 'credit' %}${{ tx.amount | currency_format }}{% endif %}</td>
53
- <td>{% if tx.tx_type == 'debit' %}${{ tx.amount | currency_format }}{% endif %}</td>
54
- <td>{% if tx.description %}{{ tx.description }}{% endif %}</td>
53
+ <td>{{ transaction_model.account_code }}</td>
54
+ <td>{{ transaction_model.account_name }}</td>
55
+ <td>{% if transaction_model.is_credit %}${{ transaction_model.amount | currency_format }}{% endif %}</td>
56
+ <td>{% if transaction_model.is_debit %}${{ transaction_model.amount | currency_format }}{% endif %}</td>
57
+ <td>{% if transaction_model.description %}{{ transaction_model.description }}{% endif %}</td>
55
58
  </tr>
56
59
  {% endfor %}
57
60
  <tr class="has-text-weight-bold">
@@ -18,21 +18,22 @@
18
18
  </tr>
19
19
  </thead>
20
20
  <tbody>
21
- {% for ledger in ledgers %}
21
+ {% for ledger_model in ledger_model_qs %}
22
22
  <tr>
23
- <td>{% if ledger.has_wrapped_model %}
24
- <a href="{{ ledger.get_wrapped_model_url }}">{{ ledger.get_wrapped_model_instance }}</a>
25
- {% else %}{{ ledger.name }}{% endif %}</td>
26
- <td><a class="button is-primary is-small"
27
- href="{% url 'django_ledger:je-list' entity_slug=entity_slug ledger_pk=ledger.uuid %}">
28
- <span class="icon has-text-dark">{% icon 'grommet-icons:transaction' 24 %}</span>
29
- <span>
30
- <span class="has-text-weight-bold">{{ ledger.journal_entries__count }}</span>
23
+ <td>{% if ledger_model.has_wrapped_model %}
24
+ <a href="{{ ledger_model.get_wrapped_model_url }}">{{ ledger_model.get_wrapped_model_instance }}</a>
25
+ {% else %}{{ ledger_model.name }}{% endif %}</td>
26
+ <td>
27
+ <a class="button is-primary is-small"
28
+ href="{{ ledger_model.get_journal_entry_list_url }}">
29
+ <span class="icon has-text-dark">{% icon 'grommet-icons:transaction' 24 %}</span>
30
+ <span>
31
+ <span class="has-text-weight-bold">{{ ledger_model.journal_entries__count }}</span>
31
32
  <span>{% trans 'Journal Entries' %}</span>
32
33
  </span>
33
-
34
- </a></td>
35
- {% if ledger.is_posted %}
34
+ </a>
35
+ </td>
36
+ {% if ledger_model.is_posted %}
36
37
  <td>
37
38
  <div class="dropdown is-hoverable">
38
39
  <div class="dropdown-trigger">
@@ -45,40 +46,40 @@
45
46
  <div class="dropdown-menu" id="dropdown-menu5" role="menu">
46
47
  <div class="dropdown-content">
47
48
  <div class="dropdown-item"><a
48
- href="{{ ledger.get_balance_sheet_url }}">{% trans 'Balance Sheet' %}</a>
49
+ href="{{ ledger_model.get_balance_sheet_url }}">{% trans 'Balance Sheet' %}</a>
49
50
  </div>
50
51
  <div class="dropdown-item"><a
51
- href="{{ ledger.get_income_statement_url }}">{% trans 'Income Statement' %}</a>
52
+ href="{{ ledger_model.get_income_statement_url }}">{% trans 'Income Statement' %}</a>
52
53
  </div>
53
54
  <div class="dropdown-item"><a
54
- href="{{ ledger.get_cash_flow_statement_url }}">{% trans 'Cash Flow Statement' %}</a>
55
+ href="{{ ledger_model.get_cash_flow_statement_url }}">{% trans 'Cash Flow Statement' %}</a>
55
56
  </div>
56
57
  </div>
57
58
  </div>
58
59
  </div>
59
60
  </td>
60
- <td>{% if ledger.earliest_timestamp %}{{ ledger.earliest_timestamp | date }}{% endif %}</td>
61
+ <td>{% if ledger_model.earliest_timestamp %}{{ ledger_model.earliest_timestamp | date }}{% endif %}</td>
61
62
  {% else %}
62
63
  <td></td>
63
64
  <td></td>
64
65
  {% endif %}
65
66
 
66
67
  <td class="has-text-centered">
67
- {% if ledger.is_posted %}
68
+ {% if ledger_model.is_posted %}
68
69
  <span class="icon has-text-success">{% icon 'ant-design:check-circle-filled' 24 %}</span>
69
70
  {% else %}
70
71
  <span class="icon is-small has-text-danger">{% icon 'maki:roadblock-11' 24 %}</span>
71
72
  {% endif %}
72
73
  </td>
73
74
  <td class="has-text-centered">
74
- {% if ledger.is_locked %}
75
+ {% if ledger_model.is_locked %}
75
76
  <span class="icon has-text-success">{% icon 'bi:lock-fill' 24 %}</span>
76
77
  {% else %}
77
78
  <span class="icon has-text-danger">{% icon 'bx:bx-lock-open-alt' 24 %}</span>
78
79
  {% endif %}
79
80
  </td>
80
81
  <td class="has-text-centered">
81
- {% if ledger.has_jes_in_locked_period %}
82
+ {% if ledger_model.has_jes_in_locked_period %}
82
83
  <span class="icon has-text-success">{% icon 'bi:lock-fill' 24 %}</span>
83
84
  {% else %}
84
85
  <span class="icon has-text-danger">{% icon 'bx:bx-lock-open-alt' 24 %}</span>
@@ -86,7 +87,7 @@
86
87
  </td>
87
88
  <td>
88
89
  <div class="dropdown is-right is-hoverable"
89
- id="ledger-action-{{ ledger.uuid }}">
90
+ id="ledger-action-{{ ledger_model.uuid }}">
90
91
  <div class="dropdown-trigger">
91
92
  <button class="button is-small is-rounded is-outlined is-dark"
92
93
  aria-haspopup="true"
@@ -95,45 +96,45 @@
95
96
  <span class="icon is-small">{% icon 'bi:arrow-down' 24 %}</span>
96
97
  </button>
97
98
  </div>
98
- <div class="dropdown-menu" id="dropdown-menu-{{ ledger.uuid }}" role="menu">
99
+ <div class="dropdown-menu" id="dropdown-menu-{{ ledger_model.uuid }}" role="menu">
99
100
  <div class="dropdown-content">
100
- <a href="{% url 'django_ledger:ledger-update' entity_slug=entity_slug ledger_pk=ledger.uuid %}"
101
+ <a href="{% url 'django_ledger:ledger-update' entity_slug=entity_slug ledger_pk=ledger_model.uuid %}"
101
102
  class="dropdown-item has-text-success">{% trans 'Edit' %}</a>
102
- {% if ledger.can_lock %}
103
- <a href="{% url 'django_ledger:ledger-action-lock' entity_slug=entity_slug ledger_pk=ledger.uuid %}"
103
+ {% if ledger_model.can_lock %}
104
+ <a href="{% url 'django_ledger:ledger-action-lock' entity_slug=entity_slug ledger_pk=ledger_model.uuid %}"
104
105
  class="dropdown-item has-text-info has-text-weight-bold">{% trans 'Lock' %}</a>
105
106
  {% endif %}
106
- {% if ledger.can_unlock %}
107
- <a href="{% url 'django_ledger:ledger-action-unlock' entity_slug=entity_slug ledger_pk=ledger.uuid %}"
107
+ {% if ledger_model.can_unlock %}
108
+ <a href="{% url 'django_ledger:ledger-action-unlock' entity_slug=entity_slug ledger_pk=ledger_model.uuid %}"
108
109
  class="dropdown-item has-text-warning has-text-weight-bold">{% trans 'UnLock' %}</a>
109
110
  {% endif %}
110
- {% if ledger.can_post %}
111
- <a href="{% url 'django_ledger:ledger-action-post' entity_slug=entity_slug ledger_pk=ledger.uuid %}"
111
+ {% if ledger_model.can_post %}
112
+ <a href="{% url 'django_ledger:ledger-action-post' entity_slug=entity_slug ledger_pk=ledger_model.uuid %}"
112
113
  class="dropdown-item has-text-info has-text-weight-bold">{% trans 'Post' %}</a>
113
114
  {% endif %}
114
- {% if ledger.can_unpost %}
115
- <a href="{% url 'django_ledger:ledger-action-unpost' entity_slug=entity_slug ledger_pk=ledger.uuid %}"
115
+ {% if ledger_model.can_unpost %}
116
+ <a href="{% url 'django_ledger:ledger-action-unpost' entity_slug=entity_slug ledger_pk=ledger_model.uuid %}"
116
117
  class="dropdown-item has-text-warning has-text-weight-bold">{% trans 'UnPost' %}</a>
117
118
  {% endif %}
118
119
 
119
- {% if ledger.can_hide %}
120
- <a href="{% url 'django_ledger:ledger-action-hide' entity_slug=entity_slug ledger_pk=ledger.uuid %}"
120
+ {% if ledger_model.can_hide %}
121
+ <a href="{% url 'django_ledger:ledger-action-hide' entity_slug=entity_slug ledger_pk=ledger_model.uuid %}"
121
122
  class="dropdown-item has-text-warning has-text-weight-bold">{% trans 'Hide' %}</a>
122
123
  {% endif %}
123
- {% if ledger.can_unhide %}
124
- <a href="{% url 'django_ledger:ledger-action-unhide' entity_slug=entity_slug ledger_pk=ledger.uuid %}"
124
+ {% if ledger_model.can_unhide %}
125
+ <a href="{% url 'django_ledger:ledger-action-unhide' entity_slug=entity_slug ledger_pk=ledger_model.uuid %}"
125
126
  class="dropdown-item has-text-danger has-text-weight-bold">{% trans 'UnHide' %}</a>
126
127
  {% endif %}
127
128
 
128
- {% if ledger.can_delete %}
129
- <a href="{% url 'django_ledger:ledger-delete' entity_slug=entity_slug ledger_pk=ledger.uuid %}"
129
+ {% if ledger_model.can_delete %}
130
+ <a href="{% url 'django_ledger:ledger-delete' entity_slug=entity_slug ledger_pk=ledger_model.uuid %}"
130
131
  class="dropdown-item has-text-danger has-text-weight-bold">{% trans 'Delete' %}</a>
131
132
  {% endif %}
132
133
  </div>
133
134
  </div>
134
135
  </div>
135
136
  </td>
136
- <td>{{ ledger.created }}</td>
137
+ <td>{{ ledger_model.created }}</td>
137
138
  </tr>
138
139
  {% endfor %}
139
140
  </tbody>