diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 4a10e2910..d8efed83a 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -627,16 +627,15 @@ class HolidaysRequestBatch(models.Model): for record in overtime_records: if remaining_deduct <= 0: break - current_remaining = record.public_holidays + record.workday # 剩余数 + current_remaining = record.remaining_quantity # 剩余数 deduct_amount = min(remaining_deduct, current_remaining) if remaining_deduct < current_remaining: carry_state = 'partial' else: carry_state = 'completed' - record.write({ 'carry_forward_date': fields.Date.to_string(period_start), - 'carry_forward_quantity': deduct_amount, + 'carry_forward_quantity': record.carry_forward_quantity + deduct_amount, 'carry_forward_state': carry_state, }) remaining_deduct -= deduct_amount