Why are Sell actions stored as Buy?

Mark Jones mark at azu.ca
Tue Jan 30 02:46:45 UTC 2018


On 2018-01-29 07:09 AM, Thomas Baumgart wrote:
> Mark,
> 
> On Sonntag, 28. Januar 2018 14:37:45 CET Mark Jones wrote:
> 
>> Hi KMyMoney devs,
>>
>> I've been studying the code base to gain a better understanding of the
>> KMyMoney model so I can contribute a fix for bug #378377 (Allow investment
>> accounts to include cash). I keep coming across code that flips a Sell
>> action into a Buy action on storage (and vice versa on loading) and I don't
>> understand why this code is required.
> 
> Cool to read/see you are working on this feature. Can you point us to where we 
> can see the code you refer to (preferably on master or 5.0)?
> 

Just trying to give something back. This project allowed me to finally drop
Quicken after years of grumbling and procrastination.

On master:

kmymoney/dialogs/investactivities.cpp:323
kmymoney/dialogs/investactivities.cpp:467
kmymoney/kmymoneyutils.cpp:532
kmymoney/kmymoneyutils.cpp:534
kmymoney/mymoney/mymoneysplit.h:228
kmymoney/mymoney/mymoneysplit.h:232
kmymoney/mymoney/mymoneysplit.cpp:265
kmymoney/mymoney/mymoneysplit.cpp:278

I understand that the amount has to be negative in a Sell/Remove for the split
to balance but I don't see why this would impact the action being stored.

>> I added back the SellShares and RemoveShares actions in my local repository
>> (for file storage only) and all appears normal. So what else did I break? :)
> 
> Where is my chrystal ball? :)
> 

Well, I was expecting a "You can't change that, you fool! It will break
everything. EVERYTHING!". I'm cautiously optimistic now.

./Mark


More information about the KMyMoney-devel mailing list