diff --git a/backend/app/payroll/vouchers/service.py b/backend/app/payroll/vouchers/service.py index f403e9b..00225f5 100644 --- a/backend/app/payroll/vouchers/service.py +++ b/backend/app/payroll/vouchers/service.py @@ -318,14 +318,14 @@ def build_voucher_summary( salary_months = [] if salary_list: salary_months = [ - f"{s.payroll_year:04d}-{s.payroll_month:02d}" + f"{s.payroll_year if s.payroll_year else 0:04d}-{s.payroll_month if s.payroll_month else 0:02d}" for s in salary_list ] bonus_months = [] if bonus_list: bonus_months = [ - f"{b.bonus_year:04d}-{b.bonus_month:02d}" + f"{b.bonus_year if b.bonus_year else 0:04d}-{b.bonus_month if b.bonus_month else 0:02d}" for b in bonus_list ] @@ -349,8 +349,9 @@ def export_vouchers(request: VoucherExportRequest) -> VoucherExportResponse: """账票エクスポート処理(メイン)""" try: # リクエストログ - end_label = f"{request.end_year:04d}-{request.end_month:02d}" if request.end_year else "None" - logger.info(f"エクスポート要求: start={request.start_year:04d}-{request.start_month:02d}, " + end_label = f"{request.end_year:04d}-{request.end_month:02d}" if request.end_year and request.end_month else "None" + start_label = f"{request.start_year:04d}-{request.start_month:02d}" if request.start_year and request.start_month else "None" + logger.info(f"エクスポート要求: start={start_label}, " f"end={end_label}, " f"type={request.voucher_type}, employees={request.employee_ids}")