From 988757d30ea29556a4a5e24213c263bcb90fbb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Thu, 20 Apr 2023 00:28:28 +0800 Subject: [PATCH] Revised the JavaScript journal entry line item editor to only override the description with the description of the original line item when there is no existing description. --- .../static/js/journal-entry-line-item-editor.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 2b3f260..ed7e257 100644 --- a/src/accounting/static/js/journal-entry-line-item-editor.js +++ b/src/accounting/static/js/journal-entry-line-item-editor.js @@ -277,10 +277,14 @@ class JournalEntryLineItemEditor { this.originalLineItemText = originalLineItem.text; this.#originalLineItemText.innerText = originalLineItem.text; this.#setEnableDescriptionAccount(false); - if (originalLineItem.description === "") { - this.#descriptionControl.classList.remove("accounting-not-empty"); - } else { - this.#descriptionControl.classList.add("accounting-not-empty"); + if (this.description === null) { + if (originalLineItem.description === "") { + this.#descriptionControl.classList.remove("accounting-not-empty"); + } else { + this.#descriptionControl.classList.add("accounting-not-empty"); + } + this.description = originalLineItem.description === ""? null: originalLineItem.description; + this.#descriptionText.innerText = originalLineItem.description; } this.#setEnableAccount(false); this.#accountControl.classList.add("accounting-not-empty");