6 Commits

5 changed files with 30 additions and 7 deletions

View File

@ -2,6 +2,25 @@ Change Log
========== ==========
Version 1.5.3
-------------
Released 2023/4/30
* Fixed the error of the net balance in the unmatched offset list.
* Revised the original line item editor not to override the existing
amount when the existing amount is less or equal to the net
balance.
Version 1.5.2
-------------
Released 2023/4/30
* Fixed the error of the net balance in the unmatched offset list.
Version 1.5.1 Version 1.5.1
------------- -------------

View File

@ -24,7 +24,7 @@ from flask_sqlalchemy import SQLAlchemy
from accounting.utils.user import UserUtilityInterface from accounting.utils.user import UserUtilityInterface
VERSION: str = "1.5.1" VERSION: str = "1.5.3"
"""The package version.""" """The package version."""
db: SQLAlchemy = SQLAlchemy() db: SQLAlchemy = SQLAlchemy()
"""The database instance.""" """The database instance."""

View File

@ -182,6 +182,8 @@ class Account(db.Model):
:param value: The new title. :param value: The new title.
:return: None. :return: None.
""" """
if self.title == value:
return
if self.title_l10n is None: if self.title_l10n is None:
self.title_l10n = value self.title_l10n = value
return return
@ -424,6 +426,8 @@ class Currency(db.Model):
:param value: The new name. :param value: The new name.
:return: None. :return: None.
""" """
if self.name == value:
return
if self.name_l10n is None: if self.name_l10n is None:
self.name_l10n = value self.name_l10n = value
return return

View File

@ -123,15 +123,13 @@ class OffsetMatcher:
.options(selectinload(JournalEntryLineItem.currency), .options(selectinload(JournalEntryLineItem.currency),
selectinload(JournalEntryLineItem.journal_entry)).all() selectinload(JournalEntryLineItem.journal_entry)).all()
for line_item in self.line_items: for line_item in self.line_items:
line_item.is_offset = line_item.id in net_balances line_item.is_offset = line_item.id not in net_balances
self.unapplied = [x for x in self.line_items self.unapplied = [x for x in self.line_items if not x.is_offset]
if x.is_offset]
for line_item in self.unapplied: for line_item in self.unapplied:
line_item.net_balance = line_item.amount \ line_item.net_balance = line_item.amount \
if net_balances[line_item.id] is None \ if net_balances[line_item.id] is None \
else net_balances[line_item.id] else net_balances[line_item.id]
self.unmatched = [x for x in self.line_items self.unmatched = [x for x in self.line_items if x.is_offset]
if not x.is_offset]
self.__populate_accumulated_balances() self.__populate_accumulated_balances()
def __populate_accumulated_balances(self) -> None: def __populate_accumulated_balances(self) -> None:

View File

@ -290,7 +290,9 @@ class JournalEntryLineItemEditor {
this.account = originalLineItem.account.copy(); this.account = originalLineItem.account.copy();
this.isAccountConfirmed = false; this.isAccountConfirmed = false;
this.#accountText.innerText = this.account.text; this.#accountText.innerText = this.account.text;
this.#amountInput.value = String(originalLineItem.netBalance); if (this.#amountInput.value === "" || new Decimal(this.#amountInput.value).greaterThan(originalLineItem.netBalance)) {
this.#amountInput.value = String(originalLineItem.netBalance);
}
this.#amountInput.max = String(originalLineItem.netBalance); this.#amountInput.max = String(originalLineItem.netBalance);
this.#amountInput.min = "0"; this.#amountInput.min = "0";
this.#validate(); this.#validate();