diff --git a/README.md b/README.md index c4c50ad..263d2d2 100644 --- a/README.md +++ b/README.md @@ -160,3 +160,13 @@ $ bean-report example.beancount print ``` Note that the original template, on 2022-01-01, is not present in this output. This is always true: if a template's schedule would not generate its original date when evaluated, the template Transaction will not be produced. + +### Options + +Additionally, the following options are available which modify the entries of the plugin: +1. `only_past_transactions` + +Default: Not set + +Only generates transactions before today's date. + diff --git a/plugin.py b/plugin.py index 419a2c2..0a0d24b 100644 --- a/plugin.py +++ b/plugin.py @@ -8,7 +8,7 @@ REPETE = 'repete' -def repete(entries, options): +def repete(entries, options, settings=None): new_entries = [] rubbish_bin = [] for txn in data.filter_txns(entries): @@ -20,7 +20,11 @@ def repete(entries, options): new = copy.deepcopy(txn) new = new._replace(date=i.date()) del new.meta[REPETE] - new_entries.append(new) + if settings == "only_past_transactions": + if new.date <= datetime.date.today(): + new_entries.append(new) + else: + new_entries.append(new) for txn in rubbish_bin: entries.remove(txn)