From 86c5371d3236335729503ed55867a8ed2aa023b6 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sat, 9 Nov 2024 16:00:51 +1100 Subject: [PATCH] Only update linked posting amounts if changing the first posting --- drcr/templates/journal/journal_edit_transaction.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drcr/templates/journal/journal_edit_transaction.html b/drcr/templates/journal/journal_edit_transaction.html index 65bc9aa..f18849a 100644 --- a/drcr/templates/journal/journal_edit_transaction.html +++ b/drcr/templates/journal/journal_edit_transaction.html @@ -223,8 +223,10 @@ } function changeAmount(el) { + // Update linked postings if there are only 2 and the first is edited + // This allows changing the second posting independently by editing it (e.g. mixing commodities of equivalent total value) let amountInputs = document.querySelectorAll('#edit-transaction-form input[name="amount"]'); - if (amountInputs.length === 2) { + if (amountInputs.length === 2 && el === amountInputs[0]) { for (inp of amountInputs) { if (inp !== el) { // Update other input with amount