Skip to content

Commit

Permalink
v0.6.3 (#216)
Browse files Browse the repository at this point in the history
* Relaxing Dependency Constraints

* Issue 208 ofx files (#209)

* fix: initial attempt

* Allow .qfx files in data_import form.

The accept attribute in the file-input field now includes .qfx files. This permits users to import data from files in .qfx format in addition to the previously supported .ofx format.

* remove debugging lines, remove debug code, add sample ofx for tests

---------

Co-authored-by: Miguel Sanda <[email protected]>

* v0.6.3 (#214)

* Add proxy functions to JournalEntry model

The commit introduces proxy functions to the JournalEntry model in the Django Ledger code. Specifically, it adds 'post', 'unpost', 'lock', and 'unlock' methods, each serving as a proxy to their counterpart methods 'mark_as_posted', 'mark_as_unposted', 'mark_as_locked', and 'mark_as_unlocked'. This simplifies the interface for interacting with JournalEntry objects.

* Minor code optimization & Django Ledger admin fields.

* access the queryset instance using .all() which returns a queryset. (#213)

* Correct urls for going back in entity and ledger balance sheet view (#215)

* Add signal handling for various models' statuses

Added signals for different status changes of Django Ledger models to enable real-time, event-driven system behavior. Signals are now sent each time an action is performed in the Ledger, Invoice, Bill, Journal Entry, Purchase Order, and Estimate. These changes will allow us to trigger specific actions depending on these changes.

* Update Python version and package versions in Pipfile

Updated the Python version from 3.11 to 3.12 in Pipfile and Pipfile.lock. Also, updated the package versions of 'django', 'faker' and 'pillow' in Pipfile.lock for improved functionality and security.

* Update Django Ledger version to 0.6.3

This commit updates the version number of the Django Ledger project in both __init__.py and pyproject.toml files. The version has been incremented from 0.6.2 to 0.6.3.

* Update signal comments in models

Updated the comments in the signals.py file to clearly specify that the signals correspond to Journal Entry Models. Additional context was also included for the signals module to enhance clarity for developers in understanding the importance of events or states in the models.

* Update documentation structure

Rearrange sections in documentation, focusing on IO and models. For docs/source/models.rst, the automodule section for django_ledger.models.signals was added. Meanwhile, in docs/source/io.rst, sections were reshuffled and terms updated for better clarity. These steps aim to enhance documentation readability and accuracy.

---------

Co-authored-by: Eric paul <[email protected]>
Co-authored-by: Ubaid ur Rehman <[email protected]>

---------

Co-authored-by: Tom Hodder <[email protected]>
Co-authored-by: Eric paul <[email protected]>
Co-authored-by: Ubaid ur Rehman <[email protected]>
  • Loading branch information
4 people authored Jul 16, 2024
1 parent 9281f08 commit b71bf96
Show file tree
Hide file tree
Showing 26 changed files with 1,334 additions and 681 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pandas = "*"
#myst_parser = "*"

[requires]
python_version = "3.11"
python_version = "3.12"

[scripts]
publish-package-test = "twine upload --repository testpypi -u __token__ -p ${DJL_PYPI_TEST_TOKEN} dist/*"
Expand Down
1,209 changes: 651 additions & 558 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion django_ledger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
default_app_config = 'django_ledger.apps.DjangoLedgerConfig'

"""Django Ledger"""
__version__ = '0.6.2'
__version__ = '0.6.3'
__license__ = 'GPLv3 License'

__author__ = 'Miguel Sanda'
Expand Down
1 change: 1 addition & 0 deletions django_ledger/admin/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class LedgerModelAdmin(ModelAdmin):
]
list_display = [
'name',
'ledger_xid',
'is_posted',
'is_locked',
'is_extended',
Expand Down
3 changes: 2 additions & 1 deletion django_ledger/forms/data_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class ImportJobModelCreateForm(ModelForm):
label='Select File...',
widget=forms.FileInput(
attrs={
'class': 'file-input'
'class': 'file-input',
'accept': '.ofx,.qfx'
})
)

Expand Down
5 changes: 3 additions & 2 deletions django_ledger/io/ofx.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ def parse_ofx(self):
def get_accounts(self):
return [
{
'bank': self.ofx_data.org,
'fid': self.ofx_data.fid,
# conditionally return the bank and fid if they are provided by the vendor
'bank': self.ofx_data.fi.org if hasattr(self.ofx_data.fi, 'org') else None,
'fid': self.ofx_data.fi.fid if hasattr(self.ofx_data.fi, 'fid') else None,
'account_type': acc.accttype,
'account_number': acc.acctid,
'routing_number': acc.bankid,
Expand Down
42 changes: 28 additions & 14 deletions django_ledger/models/bill.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Contributions to this module:
* Miguel Sanda <[email protected]>
* Pranav P Tulshyan <[email protected]>
This module implements the BillModel, which represents an Invoice received from a Supplier/Vendor, on which
the Vendor states the amount owed by the recipient for the purposes of supplying goods and/or services.
Expand Down Expand Up @@ -39,6 +38,14 @@
from django_ledger.models.items import ItemTransactionModelQuerySet, ItemTransactionModel, ItemModel, ItemModelQuerySet
from django_ledger.models.mixins import (CreateUpdateMixIn, AccrualMixIn, MarkdownNotesMixIn,
PaymentTermsMixIn, ItemizeMixIn)
from django_ledger.models.signals import (
bill_status_draft,
bill_status_in_review,
bill_status_approved,
bill_status_paid,
bill_status_canceled,
bill_status_void,
)
from django_ledger.models.utils import lazy_loader
from django_ledger.settings import (DJANGO_LEDGER_DOCUMENT_NUMBER_PADDING, DJANGO_LEDGER_BILL_NUMBER_PREFIX)

Expand Down Expand Up @@ -612,9 +619,8 @@ def get_migration_data(self,
account_unit_total=Sum('total_amount')
)

def update_amount_due(self,
itemtxs_qs: Optional[Union[ItemTransactionModelQuerySet, List[ItemTransactionModel]]] = None
) -> ItemTransactionModelQuerySet:
def update_amount_due(self, itemtxs_qs: Optional[
Union[ItemTransactionModelQuerySet, List[ItemTransactionModel]]] = None) -> ItemTransactionModelQuerySet:
"""
Updates the BillModel amount due.
Expand Down Expand Up @@ -1071,6 +1077,9 @@ def mark_as_draft(self, date_draft: Optional[date] = None, commit: bool = False,
'updated'
]
)
bill_status_draft.send_robust(sender=self.__class__,
instance=self,
commited=commit, **kwargs)

def get_mark_as_draft_html_id(self) -> str:
"""
Expand Down Expand Up @@ -1176,6 +1185,9 @@ def mark_as_review(self,
'updated'
]
)
bill_status_in_review.send_robust(sender=self.__class__,
instance=self,
commited=commit, **kwargs)

def get_mark_as_review_html_id(self) -> str:
"""
Expand Down Expand Up @@ -1283,6 +1295,9 @@ def mark_as_approved(self,
force_migrate=self.accrue
)
self.ledger.post(commit=commit, raise_exception=raise_exception)
bill_status_approved.send_robust(sender=self.__class__,
instance=self,
commited=commit, **kwargs)

def get_mark_as_approved_html_id(self) -> str:
"""
Expand Down Expand Up @@ -1406,6 +1421,9 @@ def mark_as_paid(self,
force_migrate=True
)
self.lock_ledger(commit=True)
bill_status_paid.send_robust(sender=self.__class__,
instance=self,
commited=commit, **kwargs)

def get_mark_as_paid_html_id(self) -> str:
"""
Expand Down Expand Up @@ -1507,6 +1525,9 @@ def mark_as_void(self,
force_migrate=True)
self.save()
self.lock_ledger(commit=False, raise_exception=False)
bill_status_void.send_robust(sender=self.__class__,
instance=self,
commited=commit, **kwargs)

def get_mark_as_void_html_id(self) -> str:
"""
Expand Down Expand Up @@ -1574,6 +1595,9 @@ def mark_as_canceled(self, date_canceled: Optional[date] = None, commit: bool =
self.clean()
if commit:
self.save()
bill_status_canceled.send_robust(sender=self.__class__,
instance=self,
commited=commit, **kwargs)

def get_mark_as_canceled_html_id(self) -> str:
"""
Expand Down Expand Up @@ -1890,13 +1914,3 @@ def billmodel_presave(instance: BillModel, **kwargs):


pre_save.connect(receiver=billmodel_presave, sender=BillModel)

# def billmodel_predelete(instance: BillModel, **kwargs):
# ledger_model = instance.ledger
# ledger_model.unpost(commit=False)
# ledger_model.remove_wrapped_model_info()
# ledger_model.itemtransactonmodel_set.all().delete()
# instance.ledger.delete()
#
#
# pre_delete.connect(receiver=billmodel_predelete, sender=BillModel)
8 changes: 8 additions & 0 deletions django_ledger/models/closing_entry.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""
Django Ledger created by Miguel Sanda <[email protected]>.
Copyright© EDMA Group Inc licensed under the GPLv3 Agreement.
Contributions to this module:
* Miguel Sanda <[email protected]>
"""

from datetime import datetime, time
from decimal import Decimal
from itertools import groupby, chain
Expand Down
Loading

0 comments on commit b71bf96

Please sign in to comment.