Skip to content

v0.6.3 #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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