@@ -32,16 +32,16 @@ class YuthonOvertimeLine(models.Model):
|
||||
@api.depends('last_balance', 'remainder_year')
|
||||
def _compute_vacation_sum(self):
|
||||
for rec in self:
|
||||
current_year = int(self.select_year)
|
||||
current_month = int(self.select_month)
|
||||
current_year = int(rec.select_year)
|
||||
current_month = int(rec.select_month)
|
||||
next_month = current_month + 1 if current_month < 12 else 1
|
||||
next_year = current_year if current_month < 12 else current_year + 1
|
||||
cutoff_date_last = date(next_year, next_month, 1) - timedelta(days=1)
|
||||
cutoff_dt = datetime.combine(cutoff_date_last, datetime.max.time())
|
||||
dec_2025_end = datetime(2025, 12, 31, 23, 59, 59)
|
||||
if self.employee_id.company_id.name == '集团本部':
|
||||
if rec.employee_id.company_id.name == '集团本部':
|
||||
domain = [
|
||||
('employee_id', '=', self.employee_id.id),
|
||||
('employee_id', '=', rec.employee_id.id),
|
||||
('carry_forward_state', '!=', 'completed'),
|
||||
'|',
|
||||
('is_initial_number', '=', True),
|
||||
@@ -52,9 +52,9 @@ class YuthonOvertimeLine(models.Model):
|
||||
'&', ('vacation_id', '!=', False),
|
||||
('start_time', '<', cutoff_dt)
|
||||
]
|
||||
over_ids = self.env['vacation.over.line'].search(domain)
|
||||
over_ids = rec.env['vacation.over.line'].search(domain)
|
||||
for over_id in over_ids:
|
||||
self.vacation_sum += over_id.remaining_quantity
|
||||
rec.vacation_sum += over_id.remaining_quantity
|
||||
|
||||
def open_record(self):
|
||||
self.ensure_one()
|
||||
|
||||
Reference in New Issue
Block a user