We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a14936 commit 48eadc0Copy full SHA for 48eadc0
plugin.py
@@ -0,0 +1,28 @@
1
+import copy, datetime
2
+from dateutil import rrule
3
+from recurrent.event_parser import RecurringEvent
4
+from beancount.core import data
5
+
6
7
+__plugins__ = [ 'repete', ]
8
9
+REPETE = 'repete'
10
11
+def repete(entries, options):
12
+ new_entries = []
13
+ rubbish_bin = []
14
+ for txn in data.filter_txns(entries):
15
+ if REPETE in txn.meta:
16
+ rubbish_bin.append(txn)
17
+ re = RecurringEvent(now_date=txn.date)
18
+ re.parse(txn.meta[REPETE])
19
+ for i in rrule.rrulestr(re.get_RFC_rrule(), dtstart=txn.date):
20
+ new = copy.deepcopy(txn)
21
+ new = new._replace(date=i.date())
22
+ del new.meta[REPETE]
23
+ new_entries.append(new)
24
25
+ for txn in rubbish_bin:
26
+ entries.remove(txn)
27
28
+ return entries + new_entries, []
0 commit comments