Config: Report author name

This commit is contained in:
Кокос Артем Николаевич
2026-01-21 14:00:13 +07:00
parent e9d3a273cd
commit 9a28d6d9c2
4 changed files with 53 additions and 4 deletions

View File

@@ -6,9 +6,15 @@ from odf.text import P
from odf.table import Table, TableColumn, TableRow, TableCell
from .formatter import get_version, hours_to_human, STATUS_TRANSLATION
from .utils import get_month_name_from_range
def format_odt(issue_hours: List[Tuple[Issue, float]]) -> "OpenDocument":
def format_odt(
issue_hours: List[Tuple[Issue, float]],
author: str = "",
from_date: str = "",
to_date: str = ""
) -> "OpenDocument":
template_path = "template.odt"
if not os.path.exists(template_path):
raise FileNotFoundError("Шаблон template.odt не найден...")
@@ -17,7 +23,8 @@ def format_odt(issue_hours: List[Tuple[Issue, float]]) -> "OpenDocument":
para_style_name = "Standard"
# Заголовок
header_text = "Кокос Артём Николаевич. Отчет за месяц Июль."
month_name = get_month_name_from_range(from_date, to_date)
header_text = f"{author}. Отчет за месяц {month_name}."
header_paragraph = P(stylename=para_style_name, text=header_text)
doc.text.addElement(header_paragraph)