[FIX] hr_homeworking: avoid using FullCalendar api for location record

Versions
--------
- 17.0
- saas-17.1

Steps
-----
1. Have `calendar` and `hr_homeworking` installed;
2. go to Calendar;
3. try to set a location by clicking on a date column.

Issue
-----
Odoo Client Error.

Cause
-----
The `onDayRender` function calls `onDateClick` to create a record,
passing an `info` object lacking the `jsEvent` attribute.

Solution
--------
Use `this.props.createRecord` instead.

closes odoo/odoo#159060

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
This commit is contained in:
Levi Siuzdak (sile)
2024-04-02 15:40:23 +00:00
parent ff58ff20ab
commit e0109a983c
@@ -98,8 +98,8 @@ patch(AttendeeCalendarCommonRenderer.prototype, {
if (!button || !line)
return;
info.homework = true;
button.onclick = () =>this.onDateClick(info)
line.onclick = () =>this.onDateClick(info)
button.onclick = () => this.props.createRecord(this.fcEventToRecord(info));
line.onclick = () => this.props.createRecord(this.fcEventToRecord(info));
}
if (this.props.model.scale === 'month'){
const box = info.view.el.querySelector(`.fc-day-top[data-date='${parsedDate}']`)
@@ -180,7 +180,7 @@ patch(AttendeeCalendarCommonRenderer.prototype, {
}
},
onDateClick(info){
if (info.jsEvent && info.jsEvent.target.closest(".o_worklocation_btn")) {
if (info.jsEvent.target.closest(".o_worklocation_btn")) {
info.homework = true
this.props.createRecord(this.fcEventToRecord(info));
} else {