Bug 514180 - Incorrect tax calculation when using "Net amount" mode in tax account
Summary: Incorrect tax calculation when using "Net amount" mode in tax account
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (other bugs)
Version First Reported In: git (master)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks: 241521
  Show dependency treegraph
 
Reported: 2026-01-05 13:18 UTC by Ralf Habacker
Modified: 2026-01-07 14:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.2.2
Sentry Crash Report:


Attachments
test case (29.18 KB, text/xml)
2026-01-05 13:18 UTC, Ralf Habacker
Details
test case (income + purchase) (7.28 KB, text/xml)
2026-01-05 22:18 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
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