Skip to content
Snippets Groups Projects
Commit 1ea102d4 authored by Kevin Baptiste's avatar Kevin Baptiste
Browse files

[FIX] hr_holidays: take full day leaves on Day view


The default hours of a time off created from the Day view would be the
range of hours that was selected in the calendar view, thus resulting in
leaves of half an hour.

closes odoo/odoo#106567

X-original-commit: 5155f654420433176abde675bedc4afeeeb45a1c
Signed-off-by: default avatarKevin Baptiste <kba@odoo.com>
parent 7f93f72a
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,7 @@
}
.o_timeoff_popover {
background-color: $o-view-background-color;
font-size: 12px;
ul {
......
/** @odoo-module */
import { CalendarModel } from '@web/views/calendar/calendar_model';
import { serializeDate } from "@web/core/l10n/dates";
import { deserializeDateTime, serializeDate, serializeDateTime } from "@web/core/l10n/dates";
export class TimeOffCalendarModel extends CalendarModel {
setup(params, services) {
......@@ -14,10 +14,20 @@ export class TimeOffCalendarModel extends CalendarModel {
}
makeContextDefaults(record) {
const { scale } = this.meta;
const context = super.makeContextDefaults(record);
if (this.employeeId) {
context['default_employee_id'] = this.employeeId;
}
if(['day', 'week'].includes(scale)) {
if ('default_date_from' in context) {
context['default_date_from'] = serializeDateTime(deserializeDateTime(context['default_date_from']).set({ hours: 7 }));
}
if ('default_date_to' in context) {
context['default_date_to'] = serializeDateTime(deserializeDateTime(context['default_date_from']).set({ hours: 19 }));
}
}
return context;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment