Optional disable fill time column
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user