Bug 362384

Summary: Cannot enter transaction with postdate prior to account's opening date error
Product: [Applications] kmymoney Reporter: Ben <wellnessdoc>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Ben 2016-04-27 21:59:28 UTC
Trying to manually enter a few transactions into a liability account with an opening date in 2008, but sometimes it won't let me, telling me that I "Cannot enter transaction with postdate prior to account's opening date", which seems to be happening for anything entered prior to 01/01/2016! I can get it to work if I enter a new transaction, enter the payment 'date' and 'amount' first and save it, and then go back and edit the 'from' and 'category' after the fact. If I try to enter all 4 at once, I get the error and can't save the transaction.

Reproducible: Sometimes

Steps to Reproduce:
See above.

Actual Results:  
See above.

Expected Results:  
Allow me to enter all transactions after account open date in 2008!

None.
Comment 1 Jack 2016-04-28 00:10:25 UTC
The "account" can be either the account in which you are entering the transaction, or the category to which you are assigning the transaction.  Remember, KMM treats categories internally as accounts.  If you can change the category after entering the transaction, and the transaction date is prior to the opening date of the category, that should probably count as a bug.  Categories generally get opening dates of the date they were created, which does lead to this error.
Comment 2 Ben 2016-04-28 03:48:54 UTC
(In reply to Jack from comment #1)
> The "account" can be either the account in which you are entering the
> transaction, or the category to which you are assigning the transaction. 
> Remember, KMM treats categories internally as accounts.  If you can change
> the category after entering the transaction, and the transaction date is
> prior to the opening date of the category, that should probably count as a
> bug.  Categories generally get opening dates of the date they were created,
> which does lead to this error.

Ahh, I didn't realize that. I don't know why a category would have a opening date associated with it aka be treated like an account, but changing the date of the category to an earlier date does seem to fix my problem, thnx!
Comment 3 Thomas Baumgart 2016-05-01 06:45:44 UTC
Copied from https://bugs.kde.org/show_bug.cgi?id=313793#c41 which has a different subject so I did not create a duplicate entry:

Git commit 7a4901c668871882bba75068bf1256f2bf00dba0 by Thomas Baumgart.
Committed on 16/05/2015 at 06:20.
Pushed by tbaumgart into branch 'master'.

Eliminate usage of opening date for categories

Set the opening date for newly created categories to 1900-01-01 and fix
existing ones to have that date during the consistency check. Since the
opening date of an income/expense account (aka category) is not used
throughout the application, it should not interfer with the check that
the opening dates of all accounts referenced in a transaction are prior
to the transaction's post date. Setting the opening date of a category
to the above mentioned value makes sure that a category is always
'opened' before the transaction took place.

The UI elements for the opening date have been removed from the
account/category edit dialog as they are not used anymore.
GUI:

M  +8    -2    kmymoney/dialogs/knewaccountdlg.cpp
M  +1    -0    kmymoney/dialogs/knewaccountdlg.h
M  +16   -16   kmymoney/dialogs/knewaccountdlgdecl.ui
M  +2    -0    kmymoney/kmymoney.cpp
M  +13   -0    kmymoney/mymoney/mymoneyfile.cpp
M  +71   -0    kmymoney/mymoney/mymoneyfiletest.cpp
M  +1    -0    kmymoney/mymoney/mymoneyfiletest.h

http://commits.kde.org/kmymoney/7a4901c668871882bba75068bf1256f2bf00dba0