Skip to content

Commit

Permalink
When balancing post is used to create other posts, copy all metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jwiegley committed Nov 6, 2024
1 parent d187487 commit c215f6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/xact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ namespace {
null_post->add_flags(POST_CALCULATED);
first = false;
} else {
unique_ptr<post_t> p(new post_t(null_post->account, amount.negated(),
null_post->flags() | ITEM_GENERATED | POST_CALCULATED));
p->set_state(null_post->state());
unique_ptr<post_t> p(new post_t(null_post->account, amount.negated()));
p->copy_details(*null_post);
p->set_flags(null_post->flags() | ITEM_GENERATED | POST_CALCULATED);
xact.add_post(p.release());
}
}
Expand Down
12 changes: 12 additions & 0 deletions test/regress/copy-details.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
2024-10-10 foo
expenses ; :bar:
assets:first -5 USD
assets:second -3 USD
assets:third -10 EUR

test reg %bar
24-Oct-10 foo expenses 10 EUR 10 EUR
expenses 8 USD 10 EUR
8 USD
end test

0 comments on commit c215f6e

Please sign in to comment.