[IMP] hr_holidays: set default time off type based on sequence

In hr_holidays, when creating a time off, set the default time off type based
on the sequence of the time off type

task-2832674

closes odoo/odoo#89623

Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Philippe Wauthy
2022-04-26 11:01:55 +02:00
parent 06e264e9ca
commit ead794825e
+1 -1
View File
@@ -79,7 +79,7 @@ class HolidaysRequest(models.Model):
defaults = self._default_get_request_parameters(defaults)
if 'holiday_status_id' in fields_list and not defaults.get('holiday_status_id'):
lt = self.env['hr.leave.type'].search(['|', ('requires_allocation', '=', 'no'), ('has_valid_allocation', '=', True)], limit=1)
lt = self.env['hr.leave.type'].search(['|', ('requires_allocation', '=', 'no'), ('has_valid_allocation', '=', True)], limit=1, order='sequence')
if lt:
defaults['holiday_status_id'] = lt.id