diff --git a/zeit2json.py b/zeit2json.py index b405ad1..fab232a 100755 --- a/zeit2json.py +++ b/zeit2json.py @@ -46,6 +46,7 @@ ZEIT_SHORT = False ZEIT_FILENAME = "" ZEIT_USER_NAME = "" +ZEIT_FUTURE = False DEFAULT_FILENAME = "~/zeit{YEAR}.txt" @@ -97,7 +98,7 @@ def setweek(self, weekdesc: str, weekdays: List[str] = ["so", "mo"], refdate: Op return False # sync weekdays to dates date1 = get_date(match1.group(1), refdate or today) - if date1 > today: + if date1 > today and not ZEIT_FUTURE: logg.info("going to ignore future week date (%s)", date1) self.ignore = True else: @@ -520,6 +521,8 @@ def order(name: str) -> str: help="generate ID column (was used as foreignkey in old odoo)") cmdline.add_option("-2", "--newformat", action="store_true", default=False, help="generate Ticket column (can be used to import to jira)") + cmdline.add_option("-8", "--future", action="store_true", default=ZEIT_FUTURE, + help="allow future entries from zeit timesheet") cmdline.add_option("-a", "--after", metavar="DATE", default=ZEIT_AFTER, help="only evaluate entrys on and after [first of year]") cmdline.add_option("-b", "--before", metavar="DATE", default=ZEIT_BEFORE, @@ -569,6 +572,7 @@ def order(name: str) -> str: ZEIT_DESCFILTER = opt.descfilter ZEIT_FILENAME = opt.filename ZEIT_SUMMARY = opt.summary + ZEIT_FUTURE = opt.future ZEIT_AFTER = opt.after ZEIT_BEFORE = opt.before if not args or is_dayrange(args[0]): diff --git a/zeit2odoo.py b/zeit2odoo.py index 4909e25..f2cb343 100755 --- a/zeit2odoo.py +++ b/zeit2odoo.py @@ -41,6 +41,7 @@ ZEIT_SUMMARY = "stundenzettel" ZEIT_PROJSKIP = "" ZEIT_PROJONLY = "" +ZEIT_FUTURE = False # [end zeit2json] PRICES: List[str] = [] @@ -492,6 +493,7 @@ def run(arg: str) -> None: zeit_api.ZEIT_BEFORE = DAYS.before.isoformat() zeit_api.ZEIT_USER_NAME = ZEIT_USER_NAME zeit_api.ZEIT_SUMMARY = ZEIT_SUMMARY + zeit_api.ZEIT_FUTURE = ZEIT_FUTURE conf = zeit_api.ZeitConfig(ZEITDATA, username=ZEIT_USER_NAME) zeit = zeit_api.Zeit(conf) if CSVDATA: @@ -572,6 +574,8 @@ def run(arg: str) -> None: cmdline.formatter.max_help_position = 30 cmdline.add_option("-v", "--verbose", action="count", default=0, help="more verbose logging") cmdline.add_option("-^", "--quiet", action="count", default=0, help="less verbose logging") + cmdline.add_option("-8", "--future", action="store_true", default=ZEIT_FUTURE, + help="allow future entries from zeit timesheet") cmdline.add_option("-a", "--after", metavar="DATE", default=None, help="only evaluate entrys on and after date") cmdline.add_option("-b", "--before", metavar="DATE", default=None, @@ -646,6 +650,7 @@ def run(arg: str) -> None: ZEIT_PROJONLY = opt.projonly ZEIT_PROJSKIP = opt.projskip ZEIT_SUMMARY = opt.summary + ZEIT_FUTURE = opt.future PRICES = opt.price DAYS = dayrange(opt.after, opt.before) if not args: