summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Hildebrandt <afh@surryhill.net>2023-04-19 16:28:56 +0200
committerGitHub <noreply@github.com>2023-04-19 16:28:56 +0200
commitd81e9245c60350abc1af47b466a38dc5296417d9 (patch)
tree5ee597d313de2c674ee3765a7b6aed53195ae2ad
parent1a5fba25987c8f44a0fdcf8219d9243a3d04dda2 (diff)
parentdbb350aed2e050662ebd8d746714e5d459d0587e (diff)
downloadfork-ledger-d81e9245c60350abc1af47b466a38dc5296417d9.tar.gz
fork-ledger-d81e9245c60350abc1af47b466a38dc5296417d9.tar.bz2
fork-ledger-d81e9245c60350abc1af47b466a38dc5296417d9.zip
Merge pull request #2245 from taviso/master
Fix bucket transactions with reg --related
-rw-r--r--NEWS.md2
-rw-r--r--src/item.h1
-rw-r--r--src/xact.cc2
-rw-r--r--test/regress/issue2220.test8
4 files changed, 12 insertions, 1 deletions
diff --git a/NEWS.md b/NEWS.md
index 1bc29b57..07cad014 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -9,6 +9,8 @@
- Include contrib files in distribution
+- Fix related reports when using bucket transactions (ledger/ledger#2220)
+
## 3.3.2 (2023-03-30)
- Fix divide by zero (ledger/ledger#777, ledger/ledger#2207)
diff --git a/src/item.h b/src/item.h
index c21450e8..84f062ab 100644
--- a/src/item.h
+++ b/src/item.h
@@ -86,6 +86,7 @@ public:
#define ITEM_GENERATED 0x01 // posting was not found in a journal
#define ITEM_TEMP 0x02 // posting is a managed temporary
#define ITEM_NOTE_ON_NEXT_LINE 0x04 // did we see a note on the next line?
+#define ITEM_INFERRED 0x08 // bucketed item
enum state_t { UNCLEARED = 0, CLEARED, PENDING };
diff --git a/src/xact.cc b/src/xact.cc
index 961ff010..55e816cb 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -210,7 +210,7 @@ bool xact_base_t::finalize()
// been set.
if (journal && journal->bucket && posts.size() == 1 && ! balance.is_null()) {
- null_post = new post_t(journal->bucket, ITEM_GENERATED);
+ null_post = new post_t(journal->bucket, ITEM_INFERRED);
null_post->_state = (*posts.begin())->_state;
add_post(null_post);
}
diff --git a/test/regress/issue2220.test b/test/regress/issue2220.test
new file mode 100644
index 00000000..095d0f63
--- /dev/null
+++ b/test/regress/issue2220.test
@@ -0,0 +1,8 @@
+bucket Liabilities:CreditCard
+
+2023/01/01 * Payment
+ Assets:Checking $-34.86
+
+test reg --monthly --related ^Assets:Checking
+23-Jan-01 - 23-Jan-31 Liabilities:CreditCard $34.86 $34.86
+end test