diff --git a/src/accounting/static/js/journal-entry-editor.js b/src/accounting/static/js/journal-entry-editor.js index e25f0a1..7e9b544 100644 --- a/src/accounting/static/js/journal-entry-editor.js +++ b/src/accounting/static/js/journal-entry-editor.js @@ -206,7 +206,7 @@ class JournalEntryEditor { * The account selectors * @type {{debit: AccountSelector, credit: AccountSelector}} */ - #accountSelectors; + #accountSelectors = {}; /** * Constructs a new journal entry editor. @@ -231,7 +231,9 @@ class JournalEntryEditor { this.#amount = document.getElementById(this.#prefix + "-amount"); this.#amountError = document.getElementById(this.#prefix + "-amount-error"); this.#summaryEditors = this.#initializeSummaryEditors(); - this.#accountSelectors = this.#initializeAccountSelectors(); + for (const entryType of ["debit", "credit"]) { + this.#accountSelectors[entryType] = new AccountSelector(this, entryType); + } this.#originalEntryControl.onclick = () => OriginalEntrySelector.start(this, this.originalEntryId); this.#originalEntryDelete.onclick = () => this.clearOriginalEntry(); this.#summaryControl.onclick = () => this.#summaryEditors[this.entryType].onOpen(); @@ -265,19 +267,6 @@ class JournalEntryEditor { return editors; } - /** - * Initializes the account selectors. - * - * @return {{debit: AccountSelector, credit: AccountSelector}} the account selectors - */ - #initializeAccountSelectors() { - const selectors = {}; - for (const entryType of ["debit", "credit"]) { - selectors[entryType] = new AccountSelector(this, entryType); - } - return selectors; - } - /** * Saves the original entry from the original entry selector. *