django-ledger 0.5.6.3__py3-none-any.whl → 0.5.6.5__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 (33) hide show
  1. django_ledger/__init__.py +1 -1
  2. django_ledger/admin/coa.py +3 -3
  3. django_ledger/admin/entity.py +14 -0
  4. django_ledger/forms/account.py +14 -5
  5. django_ledger/forms/coa.py +1 -6
  6. django_ledger/io/roles.py +25 -9
  7. django_ledger/migrations/0015_remove_chartofaccountmodel_locked_and_more.py +22 -0
  8. django_ledger/models/accounts.py +9 -9
  9. django_ledger/models/coa.py +261 -50
  10. django_ledger/models/entity.py +43 -28
  11. django_ledger/templates/django_ledger/account/account_create.html +17 -11
  12. django_ledger/templates/django_ledger/account/account_list.html +12 -9
  13. django_ledger/templates/django_ledger/account/account_update.html +18 -16
  14. django_ledger/templates/django_ledger/account/tags/accounts_table.html +97 -93
  15. django_ledger/templates/django_ledger/chart_of_accounts/coa_list.html +17 -0
  16. django_ledger/templates/django_ledger/{code_of_accounts → chart_of_accounts}/coa_update.html +1 -4
  17. django_ledger/templates/django_ledger/chart_of_accounts/includes/coa_card.html +74 -0
  18. django_ledger/templates/django_ledger/invoice/invoice_list.html +91 -94
  19. django_ledger/templatetags/django_ledger.py +1 -1
  20. django_ledger/tests/base.py +23 -1
  21. django_ledger/tests/test_accounts.py +16 -0
  22. django_ledger/tests/test_chart_of_accounts.py +46 -0
  23. django_ledger/urls/account.py +18 -3
  24. django_ledger/urls/chart_of_accounts.py +21 -1
  25. django_ledger/views/account.py +59 -10
  26. django_ledger/views/coa.py +83 -9
  27. django_ledger/views/mixins.py +10 -5
  28. {django_ledger-0.5.6.3.dist-info → django_ledger-0.5.6.5.dist-info}/METADATA +1 -1
  29. {django_ledger-0.5.6.3.dist-info → django_ledger-0.5.6.5.dist-info}/RECORD +33 -28
  30. {django_ledger-0.5.6.3.dist-info → django_ledger-0.5.6.5.dist-info}/AUTHORS.md +0 -0
  31. {django_ledger-0.5.6.3.dist-info → django_ledger-0.5.6.5.dist-info}/LICENSE +0 -0
  32. {django_ledger-0.5.6.3.dist-info → django_ledger-0.5.6.5.dist-info}/WHEEL +0 -0
  33. {django_ledger-0.5.6.3.dist-info → django_ledger-0.5.6.5.dist-info}/top_level.txt +0 -0
@@ -3,114 +3,118 @@
3
3
 
4
4
  {% for root_role, role_list in accounts_gb %}
5
5
  {% with title=root_role %}
6
- <div class="table-container">
7
- <table class="table is-fullwidth is-striped is-narrow is-bordered django-ledger-table-bottom-margin-75">
8
- <thead>
9
- {% if title %}
10
- <tr>
11
- <td><h2 class="is-size-3 has-text-weight-light">{{ title | upper }}</h2></td>
12
- <td></td>
13
- <td></td>
14
- <td></td>
15
- <td></td>
16
- <td></td>
17
- <td></td>
18
- </tr>
19
- {% endif %}
20
- <tr>
21
- <th>{% trans 'Account Name' %}</th>
22
- <th>{% trans 'CoA' %}</th>
23
- <th>{% trans 'Balance Type' %}</th>
24
- <th>{% trans 'Active' %}</th>
25
- <th>{% trans 'Locked' %}</th>
26
- <th>{% trans 'CoA Role Default' %}</th>
27
- <th>{% trans 'Actions' %}</th>
28
- </tr>
29
- </thead>
30
- <tbody>
31
- {% for role, acc_list in role_list %}
6
+ <div class="box">
7
+
8
+ <div class="table-container">
9
+ <table class="table is-fullwidth is-striped is-narrow django-ledger-table-bottom-margin-75">
10
+ <thead>
11
+ {% if title %}
12
+ <tr>
13
+ <td><h2 class="is-size-3 has-text-weight-light">{{ title | upper }}</h2></td>
14
+ <td></td>
15
+ <td></td>
16
+ <td></td>
17
+ <td></td>
18
+ {# <td></td>#}
19
+ <td></td>
20
+ </tr>
21
+ {% endif %}
22
+
32
23
  <tr>
33
- <td class="has-text-weight-bold is-underlined">{{ role | upper }}</td>
34
- <td></td>
35
- <td></td>
36
- <td></td>
37
- <td></td>
38
- <td></td>
39
- <td></td>
24
+ <th>{% trans 'Account Name' %}</th>
25
+ <th>{% trans 'CoA' %}</th>
26
+ <th>{% trans 'Balance Type' %}</th>
27
+ <th>{% trans 'Active' %}</th>
28
+ <th>{% trans 'CoA Role Default' %}</th>
29
+ <th>{% trans 'Actions' %}</th>
40
30
  </tr>
41
-
42
- {% for account in acc_list %}
31
+ </thead>
32
+ <tbody>
33
+ {% for role, acc_list in role_list %}
43
34
  <tr>
44
- <td style="{% if account.is_indented %}padding-left: {{ account.get_html_pixel_indent }};{% endif %}">
45
- <span class="has-text-weight-bold">{{ account.code }}</span>: {{ account.name }}</td>
46
- <td>{{ account.coa_model.name }}</td>
47
- <td>{{ account.get_balance_type_display }}</td>
48
- <td class="has-text-centered">
49
- {% if account.active %}
50
- <span class="icon has-text-success-dark">
35
+ <td class="has-text-weight-bold is-underlined">{{ role | upper }}</td>
36
+ <td></td>
37
+ <td></td>
38
+ <td></td>
39
+ <td></td>
40
+ {# <td></td>#}
41
+ <td></td>
42
+ </tr>
43
+
44
+ {% for account in acc_list %}
45
+ <tr>
46
+ <td style="{% if account.is_indented %}padding-left: {{ account.get_html_pixel_indent }};{% endif %}">
47
+ <span class="has-text-weight-bold">{{ account.code }}</span>: {{ account.name }}
48
+ </td>
49
+ <td>{{ account.coa_model.name }}</td>
50
+ <td>{{ account.get_balance_type_display }}</td>
51
+ <td class="has-text-centered">
52
+ {% if account.active %}
53
+ <span class="icon has-text-success-dark">
51
54
  {% icon 'ant-design:check-circle-filled' 24 %}
52
55
  </span>
53
- {% elif not account.active %}
54
- <span class="icon has-text-danger-dark">
56
+ {% elif not account.active %}
57
+ <span class="icon has-text-danger-dark">
55
58
  {% icon 'mdi:dangerous' 24 %}
56
59
  </span>
57
- {% endif %}
58
- </td>
60
+ {% endif %}
61
+ </td>
59
62
 
60
- <td class="has-text-centered">
61
- {% if account.locked %}
62
- <span class="icon has-text-success-dark">
63
- {% icon 'bi:lock-fill' 24 %}
64
- </span>
65
- {% elif not account.locked %}
66
- <span class="icon has-text-danger-dark">
67
- {% icon 'bx:bx-lock-open-alt' 24 %}
68
- </span>
69
- {% endif %}
70
- </td>
71
- <td class="has-text-centered">
72
- {% if account.role_default %}
73
- <span class="icon has-text-success-dark">
63
+ {# <td class="has-text-centered">#}
64
+ {# {% if account.locked %}#}
65
+ {# <span class="icon has-text-success-dark">#}
66
+ {# {% icon 'bi:lock-fill' 24 %}#}
67
+ {# </span>#}
68
+ {# {% elif not account.locked %}#}
69
+ {# <span class="icon has-text-danger-dark">#}
70
+ {# {% icon 'bx:bx-lock-open-alt' 24 %}#}
71
+ {# </span>#}
72
+ {# {% endif %}#}
73
+ {# </td>#}
74
+ <td class="has-text-centered">
75
+ {% if account.role_default %}
76
+ <span class="icon has-text-success-dark">
74
77
  {% icon 'ant-design:check-circle-filled' 24 %}
75
78
  </span>
76
- {% elif not account.role_default %}
77
- <span class="icon has-text-danger-dark">
79
+ {% elif not account.role_default %}
80
+ <span class="icon has-text-danger-dark">
78
81
  {% icon 'mdi:dangerous' 24 %}
79
82
  </span>
80
- {% endif %}
81
- </td>
82
- <td>
83
- <div class="dropdown is-right is-hoverable" id="account-action-{{ account.uuid }}">
84
- <div class="dropdown-trigger">
85
- <button class="button is-small is-rounded is-outlined"
86
- aria-haspopup="true"
87
- aria-controls="dropdown-menu">
88
- <span>{% trans 'Actions' %}</span>
89
- <span class="icon is-small">{% icon 'bi:arrow-down' 24 %}</span>
90
- </button>
91
- </div>
92
- <div class="dropdown-menu" id="dropdown-menu-{{ account.uuid }}" role="menu">
93
- <div class="dropdown-content">
94
- <a href="{% url 'django_ledger:account-detail' entity_slug=entity_slug account_pk=account.uuid %}"
95
- class="dropdown-item has-text-success">{% trans 'Detail' %}</a>
96
- <a href="{% url 'django_ledger:account-update' entity_slug=entity_slug account_pk=account.uuid %}"
97
- class="dropdown-item has-text-warning">{% trans 'Update' %}</a>
98
- {% if account.can_activate %}
99
- <a href="{% url 'django_ledger:account-action-activate' entity_slug=entity_slug account_pk=account.uuid %}"
100
- class="dropdown-item has-text-success has-text-weight-bold">{% trans 'Activate' %}</a>
101
- {% endif %}
102
- {% if account.can_deactivate %}
103
- <a href="{% url 'django_ledger:account-action-deactivate' entity_slug=entity_slug account_pk=account.uuid %}"
104
- class="dropdown-item has-text-danger has-text-weight-bold">{% trans 'Deactivate' %}</a>
105
- {% endif %}
83
+ {% endif %}
84
+ </td>
85
+ <td>
86
+ <div class="dropdown is-right is-hoverable" id="account-action-{{ account.uuid }}">
87
+ <div class="dropdown-trigger">
88
+ <button class="button is-small is-rounded is-outlined"
89
+ aria-haspopup="true"
90
+ aria-controls="dropdown-menu">
91
+ <span>{% trans 'Actions' %}</span>
92
+ <span class="icon is-small">{% icon 'bi:arrow-down' 24 %}</span>
93
+ </button>
94
+ </div>
95
+ <div class="dropdown-menu" id="dropdown-menu-{{ account.uuid }}" role="menu">
96
+ <div class="dropdown-content">
97
+ <a href="{% url 'django_ledger:account-detail' entity_slug=entity_slug account_pk=account.uuid %}"
98
+ class="dropdown-item has-text-success">{% trans 'Detail' %}</a>
99
+ <a href="{% url 'django_ledger:account-update' entity_slug=entity_slug account_pk=account.uuid %}"
100
+ class="dropdown-item has-text-warning">{% trans 'Update' %}</a>
101
+ {% if account.can_activate %}
102
+ <a href="{% url 'django_ledger:account-action-activate' entity_slug=entity_slug account_pk=account.uuid %}"
103
+ class="dropdown-item has-text-success has-text-weight-bold">{% trans 'Activate' %}</a>
104
+ {% endif %}
105
+ {% if account.can_deactivate %}
106
+ <a href="{% url 'django_ledger:account-action-deactivate' entity_slug=entity_slug account_pk=account.uuid %}"
107
+ class="dropdown-item has-text-danger has-text-weight-bold">{% trans 'Deactivate' %}</a>
108
+ {% endif %}
109
+ </div>
106
110
  </div>
107
111
  </div>
108
- </div>
109
- </td>
110
- </tr>
112
+ </td>
113
+ </tr>
114
+ {% endfor %}
111
115
  {% endfor %}
112
- {% endfor %}
113
- </table>
116
+ </table>
117
+ </div>
114
118
  </div>
115
119
  {% endwith %}
116
120
  {% endfor %}
@@ -0,0 +1,17 @@
1
+ {% extends 'django_ledger/layouts/content_layout_1.html' %}
2
+ {% load i18n %}
3
+ {% load static %}
4
+
5
+ {% block view_content %}
6
+ <div class="box">
7
+ <div class="columns is-centered is-multiline">
8
+ {% for coa_model in coa_list %}
9
+ <div class="column is-6">
10
+ {% include 'django_ledger/chart_of_accounts/includes/coa_card.html' with coa_model=coa_model %}
11
+ </div>
12
+ {% endfor %}
13
+ </div>
14
+ </div>
15
+ {% endblock %}
16
+
17
+
@@ -19,7 +19,4 @@
19
19
  </div>
20
20
  </div>
21
21
  </div>
22
- {% endblock %}
23
-
24
-
25
-
22
+ {% endblock %}
@@ -0,0 +1,74 @@
1
+ {% load django_ledger %}
2
+ {% load i18n %}
3
+ {% now "Y" as current_year %}
4
+
5
+
6
+ <div class="card">
7
+ <div class="card-header" {% if coa_model.is_default %}style="background-color: #04e304"{% endif %}>
8
+ <div class="card-header-icon">
9
+ {% icon "ic:baseline-business" 36 %}
10
+ </div>
11
+ <div class="card-header-title">
12
+ {{ coa_model.name }} {% if coa_model.is_default %} | {% trans 'DEFAULT' %}{% endif %}
13
+ </div>
14
+ </div>
15
+ <div class="card-content">
16
+ <h3 class="is-size-4">{% trans 'Entity Default' %}:
17
+ {% if coa_model.is_default %}
18
+ <span class="icon has-text-success">{% icon 'lets-icons:check-fill' 24 %}</span>
19
+ {% else %}
20
+ <span class="icon has-text-danger">{% icon 'mdi:stop-remove' 24 %}</span>
21
+ {% endif %}
22
+ </h3>
23
+ <h3 class="is-size-4">{% trans 'Is Active' %}:
24
+ {% if coa_model.is_active %}
25
+ <span class="icon has-text-success">{% icon 'lets-icons:check-fill' 24 %}</span>
26
+ {% else %}
27
+ <span class="icon has-text-danger">{% icon 'mdi:stop-remove' 24 %}</span>
28
+ {% endif %}
29
+ </h3>
30
+ <h4>CoA ID: <span class="has-text-danger has-font-weight-light">{{ coa_model.slug }}</span></h4>
31
+ <h4>{% trans 'Total Accounts' %}: {{ coa_model.accountmodel_total__count }}</h4>
32
+ <h4><span class="has-text-info">{% trans 'Active Accounts' %}</span>: {{ coa_model.accountmodel_active__count }}
33
+ </h4>
34
+ <h4><span
35
+ class="has-text-danger">{% trans 'Locked Accounts' %}</span>: {{ coa_model.accountmodel_locked__count }}
36
+ </h4>
37
+ <p class="mt-2"><span class="has-text-weight-bold">
38
+ {% trans 'Created' %}</span>: {{ coa_model.created | date }}
39
+ </p>
40
+ <p><span class="has-text-weight-bold">
41
+ {% trans 'Updated' %}</span>: {{ coa_model.created | timesince }} {% trans 'ago' %}
42
+ </p>
43
+ </div>
44
+
45
+ <footer class="card-footer">
46
+ <a href="{{ coa_model.get_account_list_url }}"
47
+ class="card-footer-item has-text-success has-text-weight-bold">
48
+ {% trans 'Accounts' %}
49
+ </a>
50
+ <a href="{{ coa_model.get_create_coa_account_url }}"
51
+ class="card-footer-item has-text-info has-text-weight-bold">
52
+ {% trans 'Add Account' %}
53
+ </a>
54
+
55
+ {% if not coa_model.is_default %}
56
+ <a href="{{ coa_model.mark_as_default_url }}"
57
+ class="card-footer-item has-text-danger has-text-weight-bold">
58
+ {% trans 'Mark as Default' %}
59
+ </a>
60
+ {% endif %}
61
+
62
+ {% if coa_model.can_deactivate %}
63
+ <a href="{{ coa_model.mark_as_inactive_url }}"
64
+ class="card-footer-item has-text-warning has-text-weight-bold">
65
+ {% trans 'Mark as Inactive' %}
66
+ </a>
67
+ {% elif coa_model.can_activate %}
68
+ <a href="{{ coa_model.mark_as_active_url }}"
69
+ class="card-footer-item has-text-success has-text-weight-bold">
70
+ {% trans 'Mark as Active' %}
71
+ </a>
72
+ {% endif %}
73
+ </footer>
74
+ </div>
@@ -4,116 +4,113 @@
4
4
  {% load django_ledger %}
5
5
 
6
6
  {% block view_content %}
7
- <div class="card">
8
- <div class="card-content">
9
- <div class="level">
10
- <div class="level-left">
7
+ <div class="box">
8
+ <div class="level">
9
+ <div class="level-left">
10
+ <div class="level-item">
11
+ {% if month %}
12
+ <h1 class="is-size-1 has-text-weight-thin">{{ month | date:'F Y' }}</h1>
13
+ {% elif year %}
14
+ <h1 class="is-size-1 has-text-weight-thin">Year {{ year | date:'Y' }}
15
+ {% trans 'Invoices' %}</h1>
16
+ {% else %}
17
+ <h1 class="is-size-1 has-text-weight-thin">{% trans 'Latest Invoices' %}</h1>
18
+ {% endif %}
19
+ </div>
20
+ <div class="level-item">
21
+ <a href="{% url 'django_ledger:invoice-create' entity_slug=view.kwargs.entity_slug %}">
22
+ <span class="icon is-large has-text-success">{% icon 'carbon:add-alt' 60 %}</span></a>
23
+ </div>
24
+ </div>
25
+ <div class="level-right">
26
+ {% if previous_month %}
11
27
  <div class="level-item">
12
- {% if month %}
13
- <h1 class="is-size-1 has-text-weight-thin">{{ month | date:'F Y' }}</h1>
14
- {% elif year %}
15
- <h1 class="is-size-1 has-text-weight-thin">Year {{ year | date:'Y' }}
16
- {% trans 'Invoices' %}</h1>
17
- {% else %}
18
- <h1 class="is-size-1 has-text-weight-thin">{% trans 'Latest Invoices' %}</h1>
19
- {% endif %}
28
+ <a class="button is-small is-dark is-outlined"
29
+ href="{% url 'django_ledger:bill-list-month' year=previous_month.year month=previous_month.month entity_slug=view.kwargs.entity_slug %}">
30
+ <span class="icon is-small">{% icon 'ant-design:left-circle-outlined' 16 %}</span>
31
+ <span>{{ previous_month | date:'F Y' }}</span>
32
+ </a>
20
33
  </div>
34
+ {% endif %}
35
+ {% if next_month %}
21
36
  <div class="level-item">
22
- <a href="{% url 'django_ledger:invoice-create' entity_slug=view.kwargs.entity_slug %}">
23
- <span class="icon is-large has-text-success">{% icon 'carbon:add-alt' 60 %}</span></a>
37
+ <a class="button is-small is-dark is-outlined"
38
+ href="{% url 'django_ledger:bill-list-month' year=next_month.year month=next_month.month entity_slug=view.kwargs.entity_slug %}">
39
+ <span class="icon is-small">{% icon 'ant-design:right-circle-outlined' 16 %}</span>
40
+ <span>{{ next_month | date:'F Y' }}</span>
41
+ </a>
24
42
  </div>
25
- </div>
26
- <div class="level-right">
27
- {% if previous_month %}
28
- <div class="level-item">
29
- <a class="button is-small is-dark is-outlined"
30
- href="{% url 'django_ledger:bill-list-month' year=previous_month.year month=previous_month.month entity_slug=view.kwargs.entity_slug %}">
31
- <span class="icon is-small">{% icon 'ant-design:left-circle-outlined' 16 %}</span>
32
- <span>{{ previous_month | date:'F Y' }}</span>
33
- </a>
34
- </div>
35
- {% endif %}
36
- {% if next_month %}
37
- <div class="level-item">
38
- <a class="button is-small is-dark is-outlined"
39
- href="{% url 'django_ledger:bill-list-month' year=next_month.year month=next_month.month entity_slug=view.kwargs.entity_slug %}">
40
- <span class="icon is-small">{% icon 'ant-design:right-circle-outlined' 16 %}</span>
41
- <span>{{ next_month | date:'F Y' }}</span>
42
- </a>
43
- </div>
44
- {% endif %}
43
+ {% endif %}
44
+
45
+ {% if previous_year %}
46
+ <div class="level-item">
47
+ <a class="button is-small is-dark is-outlined"
48
+ href="{% url 'django_ledger:invoice-list-year' year=previous_year.year entity_slug=view.kwargs.entity_slug %}">
49
+ <span class="icon is-small">{% icon 'ant-design:left-circle-outlined' 16 %}</span>
50
+ <span>{{ previous_year | date:'Y' }}</span>
51
+ </a>
52
+ </div>
53
+ {% endif %}
54
+ {% if next_year %}
55
+ <div class="level-item">
56
+ <a class="button is-small is-dark is-outlined"
57
+ href="{% url 'django_ledger:invoice-list-year' year=next_year.year entity_slug=view.kwargs.entity_slug %}">
58
+ <span class="icon is-small">{% icon 'ant-design:right-circle-outlined' 16 %}</span>
59
+ <span>{{ next_year | date:'Y' }}</span>
60
+ </a>
61
+ </div>
62
+ {% endif %}
45
63
 
46
- {% if previous_year %}
64
+ {% if page_obj %}
65
+ {% if page_obj.has_previous %}
47
66
  <div class="level-item">
48
- <a class="button is-small is-dark is-outlined"
49
- href="{% url 'django_ledger:invoice-list-year' year=previous_year.year entity_slug=view.kwargs.entity_slug %}">
50
- <span class="icon is-small">{% icon 'ant-design:left-circle-outlined' 16 %}</span>
51
- <span>{{ previous_year | date:'Y' }}</span>
67
+ <a href="?page={{ page_obj.previous_page_number }}"
68
+ class="button is-small is-dark is-outlined">
69
+ <span class="icon is-small">{% icon 'ant-design:left-circle-outlined' 24 %}</span>
52
70
  </a>
53
71
  </div>
54
72
  {% endif %}
55
- {% if next_year %}
73
+ <div class="level-item">
74
+ <p class="is-italic">page {{ page_obj.number }}
75
+ of {{ page_obj.paginator.num_pages }}</p>
76
+ </div>
77
+ {% if page_obj.has_next %}
56
78
  <div class="level-item">
57
- <a class="button is-small is-dark is-outlined"
58
- href="{% url 'django_ledger:invoice-list-year' year=next_year.year entity_slug=view.kwargs.entity_slug %}">
59
- <span class="icon is-small">{% icon 'ant-design:right-circle-outlined' 16 %}</span>
60
- <span>{{ next_year | date:'Y' }}</span>
79
+ <a href="?page={{ page_obj.next_page_number }}"
80
+ class="button is-small is-dark is-outlined">
81
+ <span class="icon is-small">{% icon 'ant-design:right-circle-outlined' 24 %}</span>
61
82
  </a>
62
83
  </div>
63
84
  {% endif %}
64
85
 
65
- {% if page_obj %}
66
- {% if page_obj.has_previous %}
67
- <div class="level-item">
68
- <a href="?page={{ page_obj.previous_page_number }}"
69
- class="button is-small is-dark is-outlined">
70
- <span class="icon is-small">{% icon 'ant-design:left-circle-outlined' 24 %}</span>
71
- </a>
72
- </div>
73
- {% endif %}
74
- <div class="level-item">
75
- <p class="is-italic">page {{ page_obj.number }}
76
- of {{ page_obj.paginator.num_pages }}</p>
77
- </div>
78
- {% if page_obj.has_next %}
79
- <div class="level-item">
80
- <a href="?page={{ page_obj.next_page_number }}"
81
- class="button is-small is-dark is-outlined">
82
- <span class="icon is-small">{% icon 'ant-design:right-circle-outlined' 24 %}</span>
83
- </a>
84
- </div>
85
- {% endif %}
86
-
87
- {% endif %}
88
- </div>
86
+ {% endif %}
89
87
  </div>
90
- {% invoice_table invoice_list %}
91
- {% if year %}
92
- <h5 class="is-size-5">Go to month:</h5>
93
- <p>
94
- <a href="{% url 'django_ledger:invoice-list' entity_slug=view.kwargs.entity_slug %}">
95
- {% trans 'All' %} |
88
+ </div>
89
+ {% invoice_table invoice_list %}
90
+ {% if year %}
91
+ <h5 class="is-size-5">Go to month:</h5>
92
+ <p>
93
+ <a href="{% url 'django_ledger:invoice-list' entity_slug=view.kwargs.entity_slug %}">
94
+ {% trans 'All' %} |
95
+ </a>
96
+ {% for date in date_list %}
97
+ <a href="{% url 'django_ledger:invoice-list-month' entity_slug=view.kwargs.entity_slug year=date.year month=date.month %}">
98
+ {{ date | date:'F' }} {% if not forloop.last %}>{% endif %}
96
99
  </a>
97
- {% for date in date_list %}
98
- <a href="{% url 'django_ledger:invoice-list-month' entity_slug=view.kwargs.entity_slug year=date.year month=date.month %}">
99
- {{ date | date:'F' }} {% if not forloop.last %}>{% endif %}
100
- </a>
101
- {% endfor %}
102
- </p>
103
- {% else %}
104
- <h5 class="is-size-5">Go to year:</h5>
105
- <p>
106
- <a href="{% url 'django_ledger:invoice-list' entity_slug=view.kwargs.entity_slug %}">
107
- {% trans 'All' %} |
100
+ {% endfor %}
101
+ </p>
102
+ {% else %}
103
+ <h5 class="is-size-5">Go to year:</h5>
104
+ <p>
105
+ <a href="{% url 'django_ledger:invoice-list' entity_slug=view.kwargs.entity_slug %}">
106
+ {% trans 'All' %} |
107
+ </a>
108
+ {% for date in date_list %}
109
+ <a href="{% url 'django_ledger:invoice-list-year' entity_slug=view.kwargs.entity_slug year=date.year %}">
110
+ {{ date.year }} {% if not forloop.last %}>{% endif %}
108
111
  </a>
109
- {% for date in date_list %}
110
- <a href="{% url 'django_ledger:invoice-list-year' entity_slug=view.kwargs.entity_slug year=date.year %}">
111
- {{ date.year }} {% if not forloop.last %}>{% endif %}
112
- </a>
113
- {% endfor %}
114
- </p>
115
- {% endif %}
116
-
117
- </div>
112
+ {% endfor %}
113
+ </p>
114
+ {% endif %}
118
115
  </div>
119
116
  {% endblock %}
@@ -738,7 +738,7 @@ def navigation_menu(context, style):
738
738
  {
739
739
  'type': 'link',
740
740
  'title': 'Chart of Accounts',
741
- 'url': reverse('django_ledger:account-list', kwargs={'entity_slug': ENTITY_SLUG})
741
+ 'url': reverse('django_ledger:coa-list', kwargs={'entity_slug': ENTITY_SLUG})
742
742
  },
743
743
  {
744
744
  'type': 'link',
@@ -6,6 +6,7 @@ from random import randint, choice
6
6
  from typing import Optional, Literal
7
7
  from zoneinfo import ZoneInfo
8
8
 
9
+ from django.conf import settings
9
10
  from django.contrib.auth import get_user_model
10
11
  from django.core.exceptions import ObjectDoesNotExist
11
12
  from django.test import TestCase
@@ -15,7 +16,6 @@ from django.utils.timezone import get_default_timezone
15
16
  from django_ledger.io.io_generator import EntityDataGenerator
16
17
  from django_ledger.models import JournalEntryModel, LedgerModel, TransactionModel, AccountModel, AccountModelQuerySet
17
18
  from django_ledger.models.entity import EntityModel, EntityModelQuerySet, UserModel
18
- from django.conf import settings
19
19
 
20
20
  UserModel = get_user_model()
21
21
 
@@ -138,6 +138,28 @@ class DjangoLedgerBaseTest(TestCase):
138
138
  return choice(self.ENTITY_MODEL_QUERYSET)
139
139
  raise ValueError('EntityModels have not been populated.')
140
140
 
141
+ def create_entity_model(self, use_accrual_method: bool = False, fy_start_month: int = 1) -> EntityModel:
142
+ """
143
+ Creates a new blank EntityModel for testing purposes.
144
+
145
+ Parameters
146
+ ----------
147
+ use_accrual_method: bool
148
+ Whether to use the accrual method. Defaults to False.
149
+ fy_start_month:
150
+ The month to start the financial year. Defaults to 1 (January).
151
+
152
+ Returns
153
+ -------
154
+ EntityModel
155
+ """
156
+ return EntityModel.create_entity(
157
+ name='Testing Inc-{randint(100000, 999999)',
158
+ use_accrual_method=use_accrual_method,
159
+ fy_start_month=fy_start_month,
160
+ admin=self.user_model
161
+ )
162
+
141
163
  @classmethod
142
164
  def create_entity_models(cls, save=True, n: int = 5):
143
165
  cls.refresh_test_data(n)
@@ -0,0 +1,16 @@
1
+ from django_ledger.models import EntityModelValidationError, AccountModel
2
+ from django_ledger.tests.base import DjangoLedgerBaseTest
3
+
4
+
5
+ class AccountModelTests(DjangoLedgerBaseTest):
6
+
7
+ def test_no_default_coa(self):
8
+ entity_model = self.create_entity_model()
9
+ self.assertFalse(entity_model.has_default_coa(), msg='New entities do not had default coa')
10
+
11
+ with self.assertRaises(EntityModelValidationError, msg='New entities do not have default coa'):
12
+ entity_model.get_default_coa()
13
+
14
+ self.assertEqual(entity_model.get_default_coa(raise_exception=False),
15
+ None,
16
+ msg='No exception should be raised when raise_exception is False')