Several account templates have an account for opening balances for example in german skr03/04 templates accounts starting with >= '9000' are designated for this purpose. In recent kmymoney version entering an opening balance always creates a new account named 'Opening balance' below equity root folder. It is not possible to setup a predefined opening balance account. Reproducible: Always Steps to Reproduce: 1. start kmymoney 2. creates a new file using german skr03 account template 3. Goto to account "1200 Bankkonto", enter opening balance and save account Actual Results: There is a new account named 'Opening balance' Expected Results: If an opening balance account is predefined the opening balance transaction should use the predefined that account instead creating a new account.
Recent kmymoney sources have support for finding an opening balance account if the related account matches the regular expression "^Opening Balances" which uses an untranslated string and works only with english/US account templates using exactly this full account name. With bug 370291 it has been reported that this account name is untranslated, having it translated make the search depending on the following translated accout names, which may or may not match the behavior of kmymoney account templates. ./fr/messages/extragear-office/kmymoney.po "Opening Balances" "Solde d'ouverture" ./nl/messages/extragear-office/kmymoney.po "Opening Balances" "Openings saldo" ./da/messages/extragear-office/kmymoney.po "Opening Balances" "Startsaldo" ./it/messages/extragear-office/kmymoney.po "Opening Balances" "Saldi iniziali" ./kk/messages/extragear-office/kmymoney.po "Opening Balances" "Ашық балансы" ./es/messages/extragear-office/kmymoney.po "Opening Balances" "Saldos de apertura" ./lt/messages/extragear-office/kmymoney.po "Opening Balances" "" ./ja/messages/extragear-office/kmymoney.po "Opening Balances" "" ./ms/messages/extragear-office/kmymoney.po "Opening Balances" "" ./bg/messages/extragear-office/kmymoney.po "Opening Balances" "" ./zh_CN/messages/extragear-office/kmymoney.po "Opening Balances" "开户" ./hu/messages/extragear-office/kmymoney.po "Opening Balances" "Nyitó egyenlegek" ./en_GB/messages/extragear-office/kmymoney.po "Opening Balances" "Opening Balances" ./gl/messages/extragear-office/kmymoney.po "Opening Balances" "Saldos de apertura" ./ca@valencia/messages/extragear-office/kmymoney.po "Opening Balances" "Saldos d'obertura" ./sv/messages/extragear-office/kmymoney.po "Opening Balances" "Ingående behållningar" ./de/messages/extragear-office/kmymoney.po "Opening Balances" "Eröffnungssaldo" ./ug/messages/extragear-office/kmymoney.po "Opening Balances" "" ./cs/messages/extragear-office/kmymoney.po "Opening Balances" "Počáteční zůstatek" ./fi/messages/extragear-office/kmymoney.po "Opening Balances" "Alkusaldo" ./el/messages/extragear-office/kmymoney.po "Opening Balances" "Ισολογισμοί ανοίγματος" ./ga/messages/extragear-office/kmymoney.po "Opening Balances" "" ./ro/messages/extragear-office/kmymoney.po "Opening Balances" "Solduri inițiale" ./sk/messages/extragear-office/kmymoney.po "Opening Balances" "Počiatočný stav" ./pt/messages/extragear-office/kmymoney.po "Opening Balances" "Saldos de Abertura" ./ast/messages/extragear-office/kmymoney.po "Opening Balances" "" ./uk/messages/extragear-office/kmymoney.po "Opening Balances" "Відкриття балансів" ./x-test/messages/extragear-office/kmymoney.po "Opening Balances" "xxOpening Balancesxx" ./zh_TW/messages/extragear-office/kmymoney.po "Opening Balances" "開戶金額" ./bs/messages/extragear-office/kmymoney.po "Opening Balances" "Početno stanje" ./mr/messages/extragear-office/kmymoney.po "Opening Balances" "" ./tr/messages/extragear-office/kmymoney.po "Opening Balances" "Açılış Bakiyeleri" ./nds/messages/extragear-office/kmymoney.po "Opening Balances" "Anfangssaldos" ./eo/messages/extragear-office/kmymoney.po "Opening Balances" "" ./ca/messages/extragear-office/kmymoney.po "Opening Balances" "Saldos d'obertura" ./eu/messages/extragear-office/kmymoney.po "Opening Balances" "Hasierako saldoak" ./ru/messages/extragear-office/kmymoney.po "Opening Balances" "Остаток на начало" ./pt_BR/messages/extragear-office/kmymoney.po "Opening Balances" "Saldos de abertura" ./et/messages/extragear-office/kmymoney.po "Opening Balances" "Algsaldod" ./pl/messages/extragear-office/kmymoney.po "Opening Balances" "Salda otwarcia" ./ia/messages/extragear-office/kmymoney.po "Opening Balances" "" In german account templates for example that would be the term "Eröffnungssaldo", which is not used in any present account template. Search for the more common term 'saldo' returns only two from 445 present account templates.
To be able to use a predefined opening balance account it is required to flag related accounts in the template file e.g. with <account type="16" name="Eröffnungssaldo"> <flag name="opening-balance" value="1"/> </account> and in the kmy file e.g. with <ACCOUNT currency="EUR" description="" parentaccount="AStd::Equity" opened="2016-01-01" number="" lastmodified="2017-05-25" type="16" id="A000002" lastreconciled="" institution="" name="Eröffnungssaldo"> <KEYVALUEPAIRS> <PAIR key="OpeningBalanceAccount" value="Yes"/> </KEYVALUEPAIRS>
Created attachment 105711 [details] Related use case The appended screenshot shows the uses cases I think they are related - did I forgot something ?
Would you want to have more than one opening balance account per security? The original idea and the design was to have just one account. So we have to make sure that only one such account can be created (one that carries the proposed KVP entry). Using the account editor the name can be changed if one does not like it. We need also make sure, that the flag cannot be altered once there is at least a single transaction assigned to that account. If you want to have more than one account it gets a bit tricky. But I think, the account can be changed by modifying the transaction in the ledger. Not sure though. Needs to be checked.
Git commit e01a94f28c771f76f8a9b1490c0e478edb23328f by Ralf Habacker. Committed on 07/06/2017 at 06:46. Pushed by habacker into branch '4.8'. Add support to use a dedicated opening balance account. With recent implementation kmymoney is not able to use a dedicated account for opening balances. Instead it (creates) and uses an opening balance account with the translated name of "Opening Balances" which may be language specific. To specify an opening balance account to be used on adding new accounts one way of operation is to set the "opening balance account" flag in the account editor for equity accounts. This is enabled if no other account contains this flag. Also changing the state of the flag is only possible if no transactions are assigned to the account having this flag. Another way to use this support is to flag an opening balance account in a kmymoney account template file. On creating a new kmymoney file the "opening balance account" flag is imported from a template account flag if specified in the following form: <account type="16" name="9000 Saldovortragskonten"> <flag name="OpeningBalanceAccount"/> </account> The template admin needs to make sure that only one template account has this flag set. Exporting the current kmymoney file to an account template exports this flag too. If there is at least one dedicate opening balance account in a kmymoney file the name will be used as template for adding additional currency related opening balance accounts in the same hierachy level as the referenced opening balance account. On the search all accounts having a currency postfix '(XXX)' are ignored. REVIEW:130143 M +10 -0 kmymoney/converter/mymoneytemplate.cpp M +50 -0 kmymoney/dialogs/knewaccountdlg.cpp M +2 -0 kmymoney/dialogs/knewaccountdlg.h M +76 -18 kmymoney/dialogs/knewaccountdlgdecl.ui M +7 -7 kmymoney/kmymoney.cpp M +34 -6 kmymoney/mymoney/mymoneyfile.cpp M +1 -1 kmymoney/mymoney/storage/mymoneystorageanon.cpp M +1 -0 kmymoney/reports/objectinfotable.cpp M +4 -1 kmymoney/reports/reportstestcommon.cpp M +1 -1 kmymoney/reports/reportstestcommon.h M +3 -1 kmymoney/templates/de_DE/skr03.kmt M +3 -1 kmymoney/templates/de_DE/skr04.kmt https://commits.kde.org/kmymoney/e01a94f28c771f76f8a9b1490c0e478edb23328f
(In reply to Ralf Habacker from comment #5) > Exporting the current kmymoney file to an account template exports > this flag too. >If there is at least one dedicate opening balance account in a kmymoney >file the name will be used as template for adding additional currency >related opening balance accounts in the same hierachy level as the >referenced opening balance account. It turned out that on writing additional opening balance accounts with different currencies it is required to write out the currency too and on importing such templates the currency need to be imported if present. Otherwise there would be two opening balance accounts for the same currency. I'm going to commit a related patch.
Git commit f235a5b236d339e6caf6c64211effbc3e8d49b44 by Ralf Habacker. Committed on 07/06/2017 at 19:27. Pushed by habacker into branch '4.8'. Fix bug having multiple opening balance accounts on template import. Exported opening balance accounts needs a 'currency' attribute to avoid multiple opening balance accounts with the same currency on template importing which happens if the kmymoney file have opening balance accounts for more than one currency. M +4 -0 kmymoney/converter/mymoneytemplate.cpp https://commits.kde.org/kmymoney/f235a5b236d339e6caf6c64211effbc3e8d49b44