Compare commits

..

No commits in common. "f3c558f48a8ed7fe44972326db5b8169bb84c6f5" and "71dfb6f003f87a3d5811ccc834d9390898418998" have entirely different histories.

3 changed files with 21 additions and 18 deletions

View File

@ -13,7 +13,7 @@ sys.path.insert(0, os.path.abspath('../../src/'))
project = 'Mia! Accounting' project = 'Mia! Accounting'
copyright = '2023, imacat' copyright = '2023, imacat'
author = 'imacat' author = 'imacat'
release = '1.4.1' release = '1.4.0'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

View File

@ -17,7 +17,7 @@
[project] [project]
name = "mia-accounting" name = "mia-accounting"
version = "1.4.1" version = "1.4.0"
description = "A Flask accounting module." description = "A Flask accounting module."
readme = "README.rst" readme = "README.rst"
requires-python = ">=3.11" requires-python = ">=3.11"

View File

@ -277,16 +277,13 @@ class JournalEntryLineItemEditor {
this.originalLineItemText = originalLineItem.text; this.originalLineItemText = originalLineItem.text;
this.#originalLineItemText.innerText = originalLineItem.text; this.#originalLineItemText.innerText = originalLineItem.text;
this.#setEnableDescriptionAccount(false); this.#setEnableDescriptionAccount(false);
if (this.description === null) { if (originalLineItem.description === "") {
if (originalLineItem.description === "") { this.#descriptionControl.classList.remove("accounting-not-empty");
this.#descriptionControl.classList.remove("accounting-not-empty"); } else {
} else { this.#descriptionControl.classList.add("accounting-not-empty");
this.#descriptionControl.classList.add("accounting-not-empty");
}
this.description = originalLineItem.description === ""? null: originalLineItem.description;
this.#descriptionText.innerText = originalLineItem.description;
} }
this.#setEnableAccount(false); this.description = originalLineItem.description === ""? null: originalLineItem.description;
this.#descriptionText.innerText = originalLineItem.description;
this.#accountControl.classList.add("accounting-not-empty"); this.#accountControl.classList.add("accounting-not-empty");
this.account = originalLineItem.account.copy(); this.account = originalLineItem.account.copy();
this.isAccountConfirmed = false; this.isAccountConfirmed = false;
@ -308,7 +305,7 @@ class JournalEntryLineItemEditor {
this.originalLineItemDate = null; this.originalLineItemDate = null;
this.originalLineItemText = null; this.originalLineItemText = null;
this.#originalLineItemText.innerText = ""; this.#originalLineItemText.innerText = "";
this.#setEnableAccount(true); this.#setEnableDescriptionAccount(true);
this.#accountControl.classList.remove("accounting-not-empty"); this.#accountControl.classList.remove("accounting-not-empty");
this.account = null; this.account = null;
this.isAccountConfirmed = false; this.isAccountConfirmed = false;
@ -475,13 +472,12 @@ class JournalEntryLineItemEditor {
this.originalLineItemDate = null; this.originalLineItemDate = null;
this.originalLineItemText = null; this.originalLineItemText = null;
this.#originalLineItemText.innerText = ""; this.#originalLineItemText.innerText = "";
this.#descriptionControl.dataset.bsTarget = `#accounting-description-editor-${this.#debitCreditSubForm.debitCredit}-modal`; this.#setEnableDescriptionAccount(true);
this.#descriptionControl.classList.remove("accounting-not-empty"); this.#descriptionControl.classList.remove("accounting-not-empty");
this.#descriptionControl.classList.remove("is-invalid"); this.#descriptionControl.classList.remove("is-invalid");
this.description = null; this.description = null;
this.#descriptionText.innerText = "" this.#descriptionText.innerText = ""
this.#descriptionError.innerText = "" this.#descriptionError.innerText = ""
this.#setEnableAccount(true);
this.#accountControl.classList.remove("accounting-not-empty"); this.#accountControl.classList.remove("accounting-not-empty");
this.#accountControl.classList.remove("is-invalid"); this.#accountControl.classList.remove("is-invalid");
this.account = null; this.account = null;
@ -515,7 +511,7 @@ class JournalEntryLineItemEditor {
this.#originalLineItemContainer.classList.remove("d-none"); this.#originalLineItemContainer.classList.remove("d-none");
this.#originalLineItemControl.classList.add("accounting-not-empty"); this.#originalLineItemControl.classList.add("accounting-not-empty");
} }
this.#descriptionControl.dataset.bsTarget = `#accounting-description-editor-${this.#debitCreditSubForm.debitCredit}-modal`; this.#setEnableDescriptionAccount(!lineItem.isMatched && this.originalLineItemId === null);
this.description = lineItem.description; this.description = lineItem.description;
if (this.description === null) { if (this.description === null) {
this.#descriptionControl.classList.remove("accounting-not-empty"); this.#descriptionControl.classList.remove("accounting-not-empty");
@ -523,7 +519,6 @@ class JournalEntryLineItemEditor {
this.#descriptionControl.classList.add("accounting-not-empty"); this.#descriptionControl.classList.add("accounting-not-empty");
} }
this.#descriptionText.innerText = this.description === null? "": this.description; this.#descriptionText.innerText = this.description === null? "": this.description;
this.#setEnableAccount(!lineItem.isMatched && this.originalLineItemId === null);
this.account = lineItem.account; this.account = lineItem.account;
this.isAccountConfirmed = true; this.isAccountConfirmed = true;
if (this.account === null) { if (this.account === null) {
@ -552,17 +547,25 @@ class JournalEntryLineItemEditor {
} }
/** /**
* Sets the enable status of the account. * Sets the enable status of the description and account.
* *
* @param isEnabled {boolean} true to enable, or false otherwise * @param isEnabled {boolean} true to enable, or false otherwise
*/ */
#setEnableAccount(isEnabled) { #setEnableDescriptionAccount(isEnabled) {
if (isEnabled) { if (isEnabled) {
this.#descriptionControl.dataset.bsToggle = "modal";
this.#descriptionControl.dataset.bsTarget = `#accounting-description-editor-${this.#debitCreditSubForm.debitCredit}-modal`;
this.#descriptionControl.classList.remove("accounting-disabled");
this.#descriptionControl.classList.add("accounting-clickable");
this.#accountControl.dataset.bsToggle = "modal"; this.#accountControl.dataset.bsToggle = "modal";
this.#accountControl.dataset.bsTarget = `#accounting-account-selector-${this.#debitCreditSubForm.debitCredit}-modal`; this.#accountControl.dataset.bsTarget = `#accounting-account-selector-${this.#debitCreditSubForm.debitCredit}-modal`;
this.#accountControl.classList.remove("accounting-disabled"); this.#accountControl.classList.remove("accounting-disabled");
this.#accountControl.classList.add("accounting-clickable"); this.#accountControl.classList.add("accounting-clickable");
} else { } else {
this.#descriptionControl.dataset.bsToggle = "";
this.#descriptionControl.dataset.bsTarget = "";
this.#descriptionControl.classList.add("accounting-disabled");
this.#descriptionControl.classList.remove("accounting-clickable");
this.#accountControl.dataset.bsToggle = ""; this.#accountControl.dataset.bsToggle = "";
this.#accountControl.dataset.bsTarget = ""; this.#accountControl.dataset.bsTarget = "";
this.#accountControl.classList.add("accounting-disabled"); this.#accountControl.classList.add("accounting-disabled");