David,

Note I'm working in 5.1 with the old ledger, and as far as I can tell, that property isn't there, or at least not used.  I'm working on https://bugs.kde.org/show_bug.cgi?id=349767 - a way to easily switch the ledger between Investment and Brokerage account.   I was thinking of adding something like that, but there is still one problem in that while an investment account can have only one brokerage account, a checking account can be the brokerage account for several different investment accounts.  (In reality, not currently possible in 5.1.)  I'm not sure how this should be handled, unless there will be a LIST of zero or more investment accounts.

On 6/22/22 10:47, Dawid Wrobel via KMyMoney-devel wrote:
Jack,

I believe that originally the 'kmm-brokerage-account' property was supposed to be used to look-up the linked-up brokerage account id.
This, however, does not seem to work, see:
https://bugs.kde.org/show_bug.cgi?id=329701
and https://bugs.kde.org/show_bug.cgi?id=350360



On Wed, Jun 22, 2022 at 4:13 PM Jack via KMyMoney-devel <kmymoney-devel@kde.org> wrote:

    On 6/22/22 02:18, Thomas Baumgart via KMyMoney-devel wrote:
    > On Dienstag, 21. Juni 2022 22:46:35 CEST Jack via KMyMoney-devel
    wrote:
    >> I'm trying to find an way to easily switch between an investment
    >> account and it's brokerage account.  I have figured out how to
    test for
    >> the two types of accounts (testing the .accountType() or
    looking for "
    >> (Brokerage)" at the end of the name.)  However, I don't see any
    way to
    >> look up an account by name.  Does this actually require looping
    through
    >> all accounts and testing if the name matches?
    > In master you can do this:
    >
    >    QString accountName;
    >    auto account =
    MyMoneyFile::instance()->accountsModel()->itemByName(accountName);
    >
    >    or if you want to stick with the model type access to the data:
    >
    >    auto idx =
    MyMoneyFile::instance()->accountsModel()->indexByName(accountName);
    >    auto name =
    idx.data(eMyMoney::Model::AccountNameRole).toString();
    >
    > which in fact does the looping for you in
    AccountsModel::indexListByName().
    >
    > Hope that helps.

    Thanks.  Either of those is shorter than what I came up with,
    although
    mine does seem to work (looking with gdb.)

    My current problem is that I'm trying to add a "go to brokerage" line
    after the "go to account" and "go to payee" menu choices, but it
    is not
    appearing in any of the menus (either main menu or context menu.)  I
    can't find anywhere in the code where either of the old ones appears
    where I haven't added the new one, so I don't know what I am missing.

    Jack



--
Best Regards,
Dawid Wrobel

Reply via email to