Revised the saveOriginalLineItem method of the JavaScript JournalEntryLineItemEditor class not to override the existing amount when the existing amount is less than the net balance. This make it easier when updating the existing journal entries.

This commit is contained in:
imacat committed 2023-04-30 15:03:59 +08:00
1 parent b718d19450
commit 46bd27e126
1 file changed
+3 -1
@@ -290,7 +290,9 @@ class JournalEntryLineItemEditor {
this.account = originalLineItem.account.copy();
this.isAccountConfirmed = false;
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.min = "0";
this.#validate();