diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py
index e758125fb..d4d285109 100644
--- a/yuthon_holiday/models/inherit_hr_leave.py
+++ b/yuthon_holiday/models/inherit_hr_leave.py
@@ -1294,6 +1294,27 @@ class HolidaysRequestBatch(models.Model):
report = self.env.ref('yuthon_holiday.action_hr_leave_batch_print')
return report.report_action(self, config=False)
+ def get_allowance_total_days(self):
+ """安全解析 holiday_allowance 多行文本中的年假总天数,供打印模板使用
+ holiday_allowance 格式示例:
+ 上年年假剩余5.000天, 本年年假剩余3.000天
+ 上年补休剩余16.0小时, 本年补休剩余8.0小时
+ """
+ self.ensure_one()
+ text = self.holiday_allowance or ''
+ total = 0.0
+ for line in text.split('\n'): # 逐行处理,防止多行混在一起
+ line = line.strip()
+ if '年假' in line: # 只取年假行
+ for part in line.split(','):
+ digits = ''.join(c for c in part if c.isdigit() or c == '.')
+ if digits:
+ try:
+ total += float(digits)
+ except (ValueError, TypeError):
+ pass
+ return total
+
class HrLeaveLine(models.Model):
_name = 'hr.leave.line'
diff --git a/yuthon_holiday/report/hr_leave_batch_report_template.xml b/yuthon_holiday/report/hr_leave_batch_report_template.xml
index 8d00a0eb4..394d12ae5 100644
--- a/yuthon_holiday/report/hr_leave_batch_report_template.xml
+++ b/yuthon_holiday/report/hr_leave_batch_report_template.xml
@@ -36,14 +36,8 @@