Only update linked posting amounts if changing the first posting

This commit is contained in:
RunasSudo 2024-11-09 16:00:51 +11:00
parent 7416d270de
commit 86c5371d32
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -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