Revert "[IMP] hr_holidays_public: handle multi company configuration"

This commit is contained in:
abdurrahman-saber 2025-09-22 15:56:20 +03:00 committed by GitHub
parent 7e04b99088
commit e65ade6ac2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 491 additions and 493 deletions

View File

@ -572,18 +572,16 @@ class HRHolidays(models.Model):
already_exist.write({'remaining_leaves': dutartion})
@api.model
def process_holidays_scheduler_queue(self):
companies = self.env['res.company'].search([])
for company in companies:
current_date_run = (datetime.utcnow() + timedelta(hours=3)).date()
employees = self.env['hr.employee'].search(
[('state', '=', 'open'), ('company_id', '=', company.id)]
[('state', '=', 'open'), ('company_id', '=', self.env.user.company_id.id)]
).filtered(
lambda emp: emp.first_hiring_date
and emp.first_hiring_date <= current_date_run
and emp.contract_id
and emp.contract_id.emp_type in ('other', 'saudi', 'displaced', 'external', 'external2')
and (not emp.contract_id.date_end or emp.contract_id.date_end and emp.contract_id.date_end >= current_date_run))
holiday_status = self.env['hr.holidays.status'].search([('company_id', '=', company.id)])
holiday_status = self.env['hr.holidays.status'].search([('company_id', '=', self.env.user.company_id.id)])
for emp in employees:
already_exist = None
current_date = (datetime.utcnow() + timedelta(hours=3)).date()