diff --git a/src/accounting/static/js/description-editor.js b/src/accounting/static/js/description-editor.js index d1e46a3..ae9f790 100644 --- a/src/accounting/static/js/description-editor.js +++ b/src/accounting/static/js/description-editor.js @@ -264,7 +264,7 @@ class DescriptionEditor { #submit() { bootstrap.Modal.getOrCreateInstance(this.#modal).hide(); if (this.#selectedAccount !== null) { - this.lineItemEditor.saveDescriptionWithAccount(this.description.value, this.#selectedAccount.code, this.#selectedAccount.text, this.#selectedAccount.isNeedOffset); + this.lineItemEditor.saveDescriptionWithAccount(this.description.value, this.#selectedAccount); } else { this.lineItemEditor.saveDescription(this.description.value); } diff --git a/src/accounting/static/js/journal-entry-line-item-editor.js b/src/accounting/static/js/journal-entry-line-item-editor.js index 3015054..5afb66b 100644 --- a/src/accounting/static/js/journal-entry-line-item-editor.js +++ b/src/accounting/static/js/journal-entry-line-item-editor.js @@ -334,14 +334,12 @@ class JournalEntryLineItemEditor { * Saves the description with the suggested account from the description editor. * * @param description {string} the description - * @param accountCode {string} the account code - * @param accountText {string} the account text - * @param isAccountNeedOffset {boolean} true if the line items in the account need offset, or false otherwise + * @param account {DescriptionEditorAccount} the suggested account */ - saveDescriptionWithAccount(description, accountCode, accountText, isAccountNeedOffset) { + saveDescriptionWithAccount(description, account) { this.#accountControl.classList.add("accounting-not-empty"); - this.account = new JournalEntryAccount(accountCode, accountText, isAccountNeedOffset); - this.#accountText.innerText = accountText; + this.account = account.copy(); + this.#accountText.innerText = account.text; this.#validateAccount(); this.saveDescription(description) }