Skip to content

Commit 0275317

Browse files
committed
allow for --future entries
1 parent b97cb8c commit 0275317

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

zeit2json.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
ZEIT_SHORT = False
4747
ZEIT_FILENAME = ""
4848
ZEIT_USER_NAME = ""
49+
ZEIT_FUTURE = False
4950

5051
DEFAULT_FILENAME = "~/zeit{YEAR}.txt"
5152

@@ -97,7 +98,7 @@ def setweek(self, weekdesc: str, weekdays: List[str] = ["so", "mo"], refdate: Op
9798
return False
9899
# sync weekdays to dates
99100
date1 = get_date(match1.group(1), refdate or today)
100-
if date1 > today:
101+
if date1 > today and not ZEIT_FUTURE:
101102
logg.info("going to ignore future week date (%s)", date1)
102103
self.ignore = True
103104
else:
@@ -520,6 +521,8 @@ def order(name: str) -> str:
520521
help="generate ID column (was used as foreignkey in old odoo)")
521522
cmdline.add_option("-2", "--newformat", action="store_true", default=False,
522523
help="generate Ticket column (can be used to import to jira)")
524+
cmdline.add_option("-8", "--future", action="store_true", default=ZEIT_FUTURE,
525+
help="allow future entries from zeit timesheet")
523526
cmdline.add_option("-a", "--after", metavar="DATE", default=ZEIT_AFTER,
524527
help="only evaluate entrys on and after [first of year]")
525528
cmdline.add_option("-b", "--before", metavar="DATE", default=ZEIT_BEFORE,
@@ -569,6 +572,7 @@ def order(name: str) -> str:
569572
ZEIT_DESCFILTER = opt.descfilter
570573
ZEIT_FILENAME = opt.filename
571574
ZEIT_SUMMARY = opt.summary
575+
ZEIT_FUTURE = opt.future
572576
ZEIT_AFTER = opt.after
573577
ZEIT_BEFORE = opt.before
574578
if not args or is_dayrange(args[0]):

zeit2odoo.py

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
ZEIT_SUMMARY = "stundenzettel"
4242
ZEIT_PROJSKIP = ""
4343
ZEIT_PROJONLY = ""
44+
ZEIT_FUTURE = False
4445
# [end zeit2json]
4546

4647
PRICES: List[str] = []
@@ -492,6 +493,7 @@ def run(arg: str) -> None:
492493
zeit_api.ZEIT_BEFORE = DAYS.before.isoformat()
493494
zeit_api.ZEIT_USER_NAME = ZEIT_USER_NAME
494495
zeit_api.ZEIT_SUMMARY = ZEIT_SUMMARY
496+
zeit_api.ZEIT_FUTURE = ZEIT_FUTURE
495497
conf = zeit_api.ZeitConfig(ZEITDATA, username=ZEIT_USER_NAME)
496498
zeit = zeit_api.Zeit(conf)
497499
if CSVDATA:
@@ -572,6 +574,8 @@ def run(arg: str) -> None:
572574
cmdline.formatter.max_help_position = 30
573575
cmdline.add_option("-v", "--verbose", action="count", default=0, help="more verbose logging")
574576
cmdline.add_option("-^", "--quiet", action="count", default=0, help="less verbose logging")
577+
cmdline.add_option("-8", "--future", action="store_true", default=ZEIT_FUTURE,
578+
help="allow future entries from zeit timesheet")
575579
cmdline.add_option("-a", "--after", metavar="DATE", default=None,
576580
help="only evaluate entrys on and after date")
577581
cmdline.add_option("-b", "--before", metavar="DATE", default=None,
@@ -646,6 +650,7 @@ def run(arg: str) -> None:
646650
ZEIT_PROJONLY = opt.projonly
647651
ZEIT_PROJSKIP = opt.projskip
648652
ZEIT_SUMMARY = opt.summary
653+
ZEIT_FUTURE = opt.future
649654
PRICES = opt.price
650655
DAYS = dayrange(opt.after, opt.before)
651656
if not args:

0 commit comments

Comments
 (0)