django-ledger 0.7.2__py3-none-any.whl → 0.7.4__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.
- django_ledger/__init__.py +1 -1
- django_ledger/contrib/django_ledger_graphene/journal_entry/schema.py +2 -3
- django_ledger/contrib/django_ledger_graphene/transaction/schema.py +9 -7
- django_ledger/forms/account.py +4 -1
- django_ledger/forms/journal_entry.py +19 -12
- django_ledger/forms/transactions.py +8 -12
- django_ledger/io/io_core.py +17 -12
- django_ledger/io/io_library.py +3 -3
- django_ledger/migrations/0001_initial.py +1 -1
- django_ledger/migrations/0019_alter_transactionmodel_amount_and_more.py +33 -0
- django_ledger/models/bill.py +17 -2
- django_ledger/models/chart_of_accounts.py +4 -0
- django_ledger/models/closing_entry.py +8 -6
- django_ledger/models/data_import.py +1 -0
- django_ledger/models/invoice.py +12 -4
- django_ledger/models/journal_entry.py +843 -481
- django_ledger/models/ledger.py +45 -4
- django_ledger/models/mixins.py +5 -5
- django_ledger/models/transactions.py +303 -305
- django_ledger/models/unit.py +42 -22
- django_ledger/static/django_ledger/bundle/djetler.bundle.js +1 -1
- django_ledger/static/django_ledger/bundle/styles.bundle.js +1 -1
- django_ledger/templates/django_ledger/account/tags/account_txs_table.html +1 -1
- django_ledger/templates/django_ledger/account/tags/accounts_table.html +1 -1
- django_ledger/templates/django_ledger/bills/bill_detail.html +1 -1
- django_ledger/templates/django_ledger/bills/bill_update.html +1 -1
- django_ledger/templates/django_ledger/components/icon.html +1 -1
- django_ledger/templates/django_ledger/data_import/tags/data_import_job_txs_imported.html +8 -1
- django_ledger/templates/django_ledger/financial_statements/balance_sheet.html +1 -0
- django_ledger/templates/django_ledger/financial_statements/tags/balance_sheet_statement.html +4 -4
- django_ledger/templates/django_ledger/financial_statements/tags/income_statement.html +118 -0
- django_ledger/templates/django_ledger/includes/nav.html +9 -5
- django_ledger/templates/django_ledger/invoice/includes/card_invoice.html +69 -69
- django_ledger/templates/django_ledger/invoice/invoice_detail.html +1 -1
- django_ledger/templates/django_ledger/journal_entry/je_create.html +2 -3
- django_ledger/templates/django_ledger/journal_entry/je_delete.html +2 -3
- django_ledger/templates/django_ledger/journal_entry/je_detail.html +1 -1
- django_ledger/templates/django_ledger/journal_entry/je_detail_txs.html +8 -8
- django_ledger/templates/django_ledger/journal_entry/je_list.html +16 -13
- django_ledger/templates/django_ledger/journal_entry/je_update.html +2 -3
- django_ledger/templates/django_ledger/journal_entry/tags/je_table.html +24 -24
- django_ledger/templates/django_ledger/journal_entry/tags/je_txs_table.html +17 -14
- django_ledger/templates/django_ledger/ledger/tags/ledgers_table.html +38 -37
- django_ledger/templates/django_ledger/transactions/tags/txs_table.html +69 -0
- django_ledger/templatetags/django_ledger.py +35 -48
- django_ledger/urls/account.py +4 -4
- django_ledger/views/account.py +8 -8
- django_ledger/views/journal_entry.py +84 -101
- django_ledger/views/ledger.py +16 -21
- django_ledger/views/mixins.py +17 -28
- {django_ledger-0.7.2.dist-info → django_ledger-0.7.4.dist-info}/METADATA +8 -3
- {django_ledger-0.7.2.dist-info → django_ledger-0.7.4.dist-info}/RECORD +56 -104
- assets/node_modules/node-gyp/gyp/gyp_main.py +0 -45
- assets/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -367
- assets/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
- assets/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1270
- assets/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
- assets/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
- assets/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
- assets/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
- assets/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
- assets/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -666
- assets/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -654
- assets/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -78
- assets/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -165
- assets/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -109
- assets/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -808
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1321
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -120
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -464
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -58
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2518
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3978
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2936
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -55
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1394
- assets/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
- assets/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3137
- assets/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
- assets/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
- assets/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1271
- assets/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
- assets/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
- assets/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -374
- assets/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1939
- assets/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
- assets/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3197
- assets/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
- assets/node_modules/node-gyp/gyp/setup.py +0 -42
- assets/node_modules/node-gyp/gyp/test_gyp.py +0 -260
- assets/node_modules/node-gyp/gyp/tools/graphviz.py +0 -102
- assets/node_modules/node-gyp/gyp/tools/pretty_gyp.py +0 -156
- assets/node_modules/node-gyp/gyp/tools/pretty_sln.py +0 -181
- assets/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +0 -339
- assets/node_modules/node-gyp/test/fixtures/test-charmap.py +0 -31
- assets/node_modules/node-gyp/update-gyp.py +0 -46
- {django_ledger-0.7.2.dist-info → django_ledger-0.7.4.dist-info}/AUTHORS.md +0 -0
- {django_ledger-0.7.2.dist-info → django_ledger-0.7.4.dist-info}/LICENSE +0 -0
- {django_ledger-0.7.2.dist-info → django_ledger-0.7.4.dist-info}/WHEEL +0 -0
- {django_ledger-0.7.2.dist-info → django_ledger-0.7.4.dist-info}/top_level.txt +0 -0
django_ledger/models/unit.py
CHANGED
|
@@ -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
|
|
6
|
-
operations into
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
process
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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'
|
|
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()
|