Account names in auto-xacts can be format strings
This commit is contained in:
parent
e77e9d692a
commit
29359f3a87
1 changed files with 9 additions and 0 deletions
|
|
@ -36,6 +36,7 @@
|
|||
#include "account.h"
|
||||
#include "journal.h"
|
||||
#include "context.h"
|
||||
#include "format.h"
|
||||
#include "pool.h"
|
||||
|
||||
namespace ledger {
|
||||
|
|
@ -775,6 +776,14 @@ void auto_xact_t::extend_xact(xact_base_t& xact, parse_context_t& context)
|
|||
account = account->parent;
|
||||
account = account->find_account(fullname);
|
||||
}
|
||||
else if (contains(fullname, "%")) {
|
||||
format_t account_name(fullname);
|
||||
std::ostringstream buf;
|
||||
buf << account_name(bound_scope);
|
||||
while (account->parent)
|
||||
account = account->parent;
|
||||
account = account->find_account(buf.str());
|
||||
}
|
||||
|
||||
// Copy over details so that the resulting post is a mirror of
|
||||
// the automated xact's one.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue