How to add Loan account to Budget View

Hi all,

I have a fairly comprehensive budget setup, but it has one flaw. My mortgage is setup as a loan account, which means the principal payment is shown as a transfer from an asset account to the loan.

Is there a way to add the loan account to the Budget View to capture this transfer? I’ve been able to add the more standard asset and liability accounts by going to Edit Account → Options tab → Budget options. This has allowed me to include my escrow, retirement, deferred maintenance, etc. accounts in budgeting. I do this because the cash has been “used” despite still being owned by me as an asset or liability.

With the mortgage, however, you don’t get the normal Edit Account window. Instead it only offers options to change details about the loan itself.

Is there a way to add the loan account so my principal payments are accounted for in my budget? Yes, those payments theoretically balance on home equity, but that isn’t useful for budgeting. The money is gone.

Thanks for any help!

I have no idea if that will do what you look out for, but for now it’s the only option there is. Since there is no direct UI to do that, you may take a look at the XML structure of your loan account in your data file. A .kmy file is nothing but a compressed (using gzip) XML file.

The <ACCOUNT> structure looks something like this (your data is certainly different):

<ACCOUNT id="A000080" parentaccount="AStd::Liability" lastreconciled="2013-09-30" lastmodified="2015-04-10" institution="I000001" opened="2002-01-01" number="" type="5" name="Loan 2" description="" currency="EUR">
  <RECONCILIATIONS>
    <RECONCILIATION date="2013-09-30" value="0/1"/>
  </RECONCILIATIONS>
  <KEYVALUEPAIRS>
    <PAIR key="final-payment" value="21283/100"/>
    <PAIR key="fixed-interest" value="yes"/>
    <PAIR key="interest-calculation" value="paymentReceived"/>
    <PAIR key="ir-2002-01-01" value="47/100"/>
    <PAIR key="ir-2004-07-01" value="52/100"/>
    <PAIR key="kmm-iconpos" value="30;463"/>
    <PAIR key="lastStatementBalance" value="0/1"/>
    <PAIR key="loan-amount" value="370892/100"/>
    <PAIR key="mm-closed" value="yes"/>
    <PAIR key="payee" value="P000021"/>
    <PAIR key="periodic-payment" value="2190/100"/>
    <PAIR key="reconciliationHistory" value="2013-09-30:0/1"/>
    <PAIR key="schedule" value="SCH000003"/>
    <PAIR key="term" value="297"/>
  </KEYVALUEPAIRS>
</ACCOUNT>

To achieve what you want, you may try to add the following to the KEYVALUEPAIRS of your loan account:

<PAIR key="budgetAccountType" value="13"/>

where 13 is the account type to be used (expense).

Preparation and test

Without modifying your data you can do the following:

  1. open your <name>.kmy data file
  2. Save as <name>.xml (make sure to use storage type XML and select the filter for XML files when providing the <name>.
  3. Quit KMyMoney
  4. Open <name>.xml in your favorite editor, search the <ACCOUNT> structure for your loan account
  5. Add the additional <PAIR> to assign the budgetAccountType as shown above by inserting that line right above </KEYVALUEPAIRS> at the end of the list, though the exact location does not matter.
  6. Save the file and quit the editor
  7. Open the <name>.xml in KMyMoney (make sure <name>.xml is shown in the title bar of the application). If it shows <name>.kmy select File/Open and open <name>.xml. Check the title bar again.
  8. Check if the change does what you want on your budget.
  9. Quit KMyMoney

Depending on the results of step 8. you proceed as follows:

Case : This is not working for me and does not what I want

  1. Remove <name>.xml (make sure you remove the .xml one)
  2. Open <name>.kmy in KMyMoney and proceed with your work

Case : OK, this is cool and does what I want

This now modifies (actually updates) your data.

  1. Remove <name>.kmy (make sure you remove the .kmy one) or rename it to something else as backup (just in case)
  2. Rename <name>.xml to <name>.kmy
  3. Open <name>.kmy in KMyMoney and proceed with your work

Note: There is no need to compress the file after step 2. KMyMoney reads both versions alike. As part of your next save operation KMyMoney will compressed the data again.

Hope that is clear and helps. Would be nice to read about the results.

1 Like

@ipwizard, that worked wonderfully!

Everything seems to be stable and the reporting is showing it is tracking as intended. Saving, quitting, and opening also didn’t seem to erase the change. Thank you very much for that simple fix.

I will add some information to this open bug from 2019: https://bugs.kde.org/show_bug.cgi?id=415514