Bug 402794

Summary: Automatic category assignment does not respect tax assignment
Product: [Applications] kmymoney Reporter: Thomas Baumgart <tbaumgart>
Component: importerAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 5.0.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.3

Description Thomas Baumgart 2019-01-02 17:16:05 UTC
SUMMARY
Importing transaction assigns categories based on previous transactions found with the same payee. In case such a historic transaction contains two splits (a net income/expense and a tax split) then the splits are copied but the amounts are not adjusted to the value of the imported transaction.

STEPS TO REPRODUCE
1. Create payee with and assign a tax transaction
2. Import a transaction from the same payee with a different amount
3. 

OBSERVED RESULT
Splits are setup to reflect the same income/expense and tax category but the transaction is not balanced.

EXPECTED RESULT
Transaction is balanced.

ADDITIONAL INFORMATION
The copy split feature is also affected.
Comment 1 Thomas Baumgart 2019-01-02 19:25:58 UTC
Git commit f838e3c0b7b3cd5543af3ce4a6119a9a41b2fcba by Thomas Baumgart.
Committed on 02/01/2019 at 17:23.
Pushed by tbaumgart into branch '5.0'.

Automatically adjust tax split if possible

Importing transaction assigns categories based on previous transactions
found with the same payee or a preselected category. In case such a
historic transaction contains multiple splits then these splits are
copied but the amounts of the splits are not adjusted based on the value
of the imported transaction.

This change now adjusts in case the resulting transaction consists of an
asset/liability account, a taxable category and a tax category such that
the sum of all splits is zero based on the imported transaction.

This also fixes the "Copy splits" feature when used on a taxed
transaction.
FIXED-IN: 5.0.3

M  +10   -1    kmymoney/converter/mymoneystatementreader.cpp
M  +53   -7    kmymoney/mymoney/mymoneyfile.cpp
M  +15   -1    kmymoney/mymoney/mymoneyfile.h
M  +4    -0    kmymoney/views/kgloballedgerview.cpp

https://commits.kde.org/kmymoney/f838e3c0b7b3cd5543af3ce4a6119a9a41b2fcba