Merge pull request #225 from expsa/dev_odex25_hr

[FIX] refactore name in holday type
This commit is contained in:
AbuzarExp 2024-07-16 15:11:09 +03:00 committed by GitHub
commit 407ae36715
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -44,7 +44,7 @@ msgstr "!مهم؛ حجم الخط: 8px؛ min-width: 18px \"& gt؛"
#: code:addons/hr_holidays_community/models/hr_holidays.py:0
#, python-format
msgid "%g remaining out of %g"
msgstr ""
msgstr ""%g المتبقي من %g""
#. module: hr_holidays_community
#: code:addons/hr_holidays_community/models/hr_holidays.py:0

View File

@ -108,6 +108,22 @@ class HrHolidaysStatus(models.Model):
if not count and not order and self._context.get('employee_id'):
leaves = self.browse(leave_ids)
sort_key = lambda l: (l.leave_type, l.sickness_severity, l.virtual_remaining_leaves)
employee_id = self._context.get('employee_id')
balance = self.env['hr.holidays'].search([
('employee_id', '=', int(employee_id)),
('holiday_status_id.leave_type', '!=', 'sick'),
('type', '=', 'add'),
('check_allocation_view', '=', 'balance')
]).mapped('holiday_status_id')
balance_sick = self.env['hr.holidays'].search([
('employee_id', '=', int(employee_id)),
('holiday_status_id.leave_type', '=', 'sick'),
('type', '=', 'add'),
('check_allocation_view', '=', 'balance'),
('remaining_leaves', '>', 0)
]).mapped('holiday_status_id').sorted(key=lambda eval: eval.sickness_severity, reverse=False)
balance_sick = balance_sick and balance_sick[0] or balance_sick
leaves = balance | balance_sick
return leaves.sorted(key=sort_key, reverse=False).ids
return leave_ids