Bug 514180

Summary: Incorrect tax calculation when using "Net amount" mode in tax account
Product: [Applications] kmymoney Reporter: Ralf Habacker <ralf.habacker>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git (master)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.2.2
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 241521    
Attachments: test case
test case (income + purchase)

Description Ralf Habacker 2026-01-05 13:18:27 UTC
Created attachment 188234 [details]
test case

STEPS TO REPRODUCE
1. download snapshot of kmymoney from master git branch
2. start kmymoney and load the appended test case
3. In the home "tab" click on  "checking" account
4. See second transaction or create a new transaction with amount of 100€ and category "income-tax-net-amount"

OBSERVED RESULT
In the payment column of the associated transaction the value for the checking account is incorrect - it does not include the tax added.

EXPECTED RESULT
In the payment column of the associated transaction the value for the checking account should include the tax  and therefore should be 119€, not 100€ 

SOFTWARE/OS VERSIONS
Operating System: openSUSE Leap 15.6
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12

ADDITIONAL INFORMATION
This problem does not occur when using a tax account in “Gross amount” mode.
Comment 1 Ralf Habacker 2026-01-05 21:50:32 UTC
The actual documentation says at https://invent.kde.org/office/kmymoney/-/blob/master/doc/details-categories.docbook?ref_type=heads#L157

> When I buy goods, I enter them into a transaction. Let's assume
> I have selected the gross amount entry method, once I enter the
> category and amount, kmymoney will recognize that there's a VAT
> assignment and calculate the VAT part, create a second split with
> the VAT account and VAT amount and reduce the category amount.

This belongs to the "Gross amount" mode, but a documentation for the "Net amount" mode is missing.
Comment 2 Ralf Habacker 2026-01-05 21:53:41 UTC
The previous major version of kmymoney does not display this error, so it must have been introduced at some point in version 5.

However, the documentation for the “Net amount” mode is also missing in the previous major version.
Comment 3 Ralf Habacker 2026-01-05 22:18:45 UTC
Created attachment 188244 [details]
test case (income + purchase)

The problem also affects purchasing accounts with assigned tax accounts.

To reproduce this, add a transaction for the checking account with the category “purchase-tax-net-amount.”
Comment 4 Ralf Habacker 2026-01-05 22:32:42 UTC
The unit tests for kmymoney include a test case for VAT allocations (see https://invent. kde.org/office/kmymoney/-/blob/master/kmymoney/mymoney/tests/test-mymoneyfile.cpp?ref_type=heads#L2651) that works as expected, which suggests that something in the source code for the transaction editor has broken.
Comment 5 Ralf Habacker 2026-01-07 07:11:58 UTC
Git commit bfe0d32b426eb395d3432f13cfd369345d99973c by Ralf Habacker.
Committed on 07/01/2026 at 07:11.
Pushed by habacker into branch 'master'.

Fix Net→Gross UI update in new transaction editor for VAT transactions

Previously, when entering an amount in Net mode or switching categories,
the  new transaction editor did not update the displayed gross amount
in the credit/debit field. This was because updateVAT() recalculated
the splits in the backend (asset/liability, category, tax), but the
editor's creditDebitEdit widget was never updated with the new
gross value.
FIXED-IN: 5.2.2

M  +20   -0    kmymoney/views/newtransactioneditor.cpp

https://invent.kde.org/office/kmymoney/-/commit/bfe0d32b426eb395d3432f13cfd369345d99973c
Comment 6 Thomas Baumgart 2026-01-07 14:27:21 UTC
Git commit 1ea8bc7487ed470b1b9deef7c25d439b4833f268 by Thomas Baumgart, on behalf of Ralf Habacker.
Committed on 07/01/2026 at 14:26.
Pushed by tbaumgart into branch '5.2'.

Fix Net→Gross UI update in new transaction editor for VAT transactions

Previously, when entering an amount in Net mode or switching categories,
the  new transaction editor did not update the displayed gross amount
in the credit/debit field. This was because updateVAT() recalculated
the splits in the backend (asset/liability, category, tax), but the
editor's creditDebitEdit widget was never updated with the new
gross value.
FIXED-IN: 5.2.2
(cherry picked from commit bfe0d32b426eb395d3432f13cfd369345d99973c)

M  +20   -0    kmymoney/views/newtransactioneditor.cpp

https://invent.kde.org/office/kmymoney/-/commit/1ea8bc7487ed470b1b9deef7c25d439b4833f268