From ead6c72d16485ad61aea08aa2c83cd8ac258ab64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=BE=D0=BA=D0=BE=D1=81=20=D0=90=D1=80=D1=82=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B5=D0=B2=D0=B8?= =?UTF-8?q?=D1=87?= Date: Thu, 22 Jan 2026 12:38:06 +0700 Subject: [PATCH] Optional disable fill time column --- redmine_reporter/cli.py | 15 +++++++++++++-- redmine_reporter/formatter_odt.py | 9 +++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/redmine_reporter/cli.py b/redmine_reporter/cli.py index b10f1c2..7667672 100644 --- a/redmine_reporter/cli.py +++ b/redmine_reporter/cli.py @@ -43,6 +43,11 @@ def main(argv: Optional[List[str]] = None) -> int: default="", help="Override author name from .env (REDMINE_AUTHOR)" ) + parser.add_argument( + "--no-time", + action="store_true", + help="Do not include 'Затрачено за отчетный период' column in ODT report" + ) args = parser.parse_args(argv) try: @@ -74,8 +79,14 @@ def main(argv: Optional[List[str]] = None) -> int: print("❌ Output file must end with .odt", file=sys.stderr) return 1 try: - author = Config.get_author(args.author) - doc = format_odt(issue_hours, author=author, from_date=from_date, to_date=to_date) + doc = format_odt( + issue_hours, + author=Config.get_author(args.author), + from_date=from_date, + to_date=to_date, + fill_time=not args.no_time + ) + doc.save(args.output) print(f"✅ Report saved to {args.output}") except ImportError: diff --git a/redmine_reporter/formatter_odt.py b/redmine_reporter/formatter_odt.py index 1f97afc..d642830 100644 --- a/redmine_reporter/formatter_odt.py +++ b/redmine_reporter/formatter_odt.py @@ -14,7 +14,8 @@ def format_odt( issue_hours: List[Tuple[Issue, float]], author: str = "", from_date: str = "", - to_date: str = "" + to_date: str = "", + fill_time: bool = True ) -> "OpenDocument": template_path = "template.odt" if not os.path.exists(template_path): @@ -132,7 +133,11 @@ def format_odt( row.addElement(status_cell) time_cell = TableCell(stylename=cell_style_name) - p = P(stylename=para_style_name, text=hours_to_human(hours)) + if fill_time: + time_text = hours_to_human(hours) + else: + time_text = "" + p = P(stylename=para_style_name, text=time_text) time_cell.addElement(p) row.addElement(time_cell)