[FIX] hr_holidays: delete time off from calendar view

Steps to reproduce:
    - logged in as user with admin or officer permissions;
    - create time off request with config for sick time off request;
    - try to delete partially approved time off request from calendar view by pressing delete button.
    (The button is in the window that opens when you select a time off)

Issue:
    Partially approved time off request are not deleted when using delete button in calendar view.
    (It can only be deleted via the list view)

Cause:
	The function which deletes the element is not called.

opw-3061570

closes odoo/odoo#106023

X-original-commit: b9d01d30474303747f65376b0abf4cde3d2400e7
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2022-11-18 14:00:27 +01:00
parent ef172fee4c
commit 9f193df0fa
2 changed files with 11 additions and 4 deletions
@@ -68,7 +68,7 @@ export class TimeOffCalendarController extends CalendarController {
}
deleteRecord(record) {
if (!record.rawRecord.can_cancel) {
if (!record.can_cancel) {
return super.deleteRecord(record);
}
@@ -88,6 +88,7 @@ export class TimeOffCalendarController extends CalendarController {
title: record.title,
viewId: this.model.formViewId,
onRecordSaved: () => this.model.load(),
onRecordDeleted: (record) => this.deleteRecord(record),
onLeaveCancelled: () => {
this.model.load();
this.env.timeOffBus.trigger('update_dashboard');
@@ -16,11 +16,12 @@ export class TimeOffDialogFormController extends FormController {
}
deleteRecord() {
const leaveId = this.model.root.data.id;
const record = this.model.root.data
this.props.onRecordDeleted(record)
this.props.onCancelLeave();
if (this.model.root.data.can_cancel) {
this.leaveCancelWizard(leaveId, () => {
if (record.can_cancel) {
this.leaveCancelWizard(record.id, () => {
this.props.onLeaveCancelled();
});
}
@@ -35,6 +36,7 @@ export class TimeOffDialogFormController extends FormController {
TimeOffDialogFormController.props = {
...FormController.props,
onCancelLeave: Function,
onRecordDeleted: Function,
onLeaveCancelled: Function,
}
@@ -54,11 +56,15 @@ export class TimeOffFormViewDialog extends FormViewDialog {
onCancelLeave: () => {
this.props.close();
},
onRecordDeleted: (record) => {
this.props.onRecordDeleted(record)
},
onLeaveCancelled: this.props.onLeaveCancelled.bind(this),
})
}
}
TimeOffFormViewDialog.props = {
...TimeOffFormViewDialog.props,
onRecordDeleted: Function,
onLeaveCancelled: Function,
}