Replace the GnuCash import checkbox column with native multi-select

Selecting bookings to import now uses the Treeview's own multi-selection
(click, Ctrl+click, Shift+click for ranges) instead of a dedicated
checkbox column that had to be clicked precisely -- more standard and
much faster for marking many rows at once.

Bookings matching an existing payment's date+amount are no longer
blocked from selection; they're still flagged (red row, "Bereits
vorhanden"). If any selected booking is such a duplicate, importing now
asks whether to skip those or instead adopt the booking's description
onto the already-recorded payment. That relabeling is handled by a new
repository.update_payment_reference, which only touches the reference
and gnucash_transaction_id fields, leaving date/amount/allocations
untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Marcel Peterkau
2026-08-14 23:43:55 +02:00
co-authored by Claude Sonnet 5
parent e25accd35b
commit 195ae0e228
3 changed files with 196 additions and 50 deletions
+65
View File
@@ -251,6 +251,71 @@ def test_payment_can_be_deleted_with_its_allocations(tmp_path) -> None:
assert repository.get_events(member.member_id)[-1].event_type == "payment_deleted"
def test_payment_reference_can_be_replaced_without_touching_amount_or_allocations(tmp_path) -> None:
repository, member = _repository_with_claim(tmp_path)
payment = repository.record_payment(
member.member_id,
"claim-1",
payment_date="2026-06-21",
amount="10.00",
allocation_amount="10.00",
reference="Alte Referenz",
)
updated = repository.update_payment_reference(
member.member_id,
payment["payment_id"],
reference="Neue Referenz aus GnuCash",
gnucash_transaction_id="TX-99",
)
data = repository.get_contributions(member.member_id)
assert updated["reference"] == "Neue Referenz aus GnuCash"
assert updated["gnucash_transaction_id"] == "TX-99"
assert data.payments[0]["amount"] == "10.00"
assert payment_allocated_total(data, payment["payment_id"]) == Decimal("10.00")
assert repository.get_events(member.member_id)[-1].event_type == "payment_changed"
def test_payment_reference_update_rejects_gnucash_id_already_used_elsewhere(tmp_path) -> None:
repository, member = _repository_with_claim(tmp_path)
repository.record_payment(
member.member_id,
"claim-1",
payment_date="2026-06-21",
amount="10.00",
allocation_amount="10.00",
gnucash_transaction_id="TX-1",
)
data = repository.get_contributions(member.member_id)
data.claims.append(
{
"claim_id": "claim-2",
"claim_key": "second-claim",
"title": "Zweite Forderung",
"amount": "20.00",
"due_date": "2026-12-31",
"status": "open",
}
)
repository.save_contributions(member.member_id, data)
second_payment = repository.record_payment(
member.member_id,
"claim-2",
payment_date="2026-06-22",
amount="20.00",
allocation_amount="20.00",
)
with pytest.raises(RepositoryError, match="GnuCash-ID bereits verwendet"):
repository.update_payment_reference(
member.member_id,
second_payment["payment_id"],
reference="Duplikatversuch",
gnucash_transaction_id="TX-1",
)
def test_credit_claim_settlement_is_displayed_as_positive_amount() -> None:
claim = {"claim_id": "claim-1", "title": "Kautionsrückzahlung", "amount": "-25.00"}
data = ContributionData(