From 02c8a53bdc23f5302d430ac79880f001c8c80575 Mon Sep 17 00:00:00 2001 From: FrancoisGe Date: Tue, 1 Aug 2023 18:31:23 +0000 Subject: [PATCH] [FIX] hr_holidays: use record.resId Since the relational model was rewritten (PR 114024), the record id is no longer present in data. We must replace record.data.id with record.resId. closes odoo/odoo#130466 Signed-off-by: Aaron Bohy (aab) --- .../src/views/view_dialog/form_view_dialog.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/hr_holidays/static/src/views/view_dialog/form_view_dialog.js b/addons/hr_holidays/static/src/views/view_dialog/form_view_dialog.js index 4e1e04104a2..a6a8ade711d 100644 --- a/addons/hr_holidays/static/src/views/view_dialog/form_view_dialog.js +++ b/addons/hr_holidays/static/src/views/view_dialog/form_view_dialog.js @@ -18,39 +18,39 @@ export class TimeOffDialogFormController extends FormController { } get record() { - return this.model.root.data; + return this.model.root; } async onClick(action) { - const args = (action === 'action_approve') ? [this.record.id, false] : [this.record.id]; + const args = (action === 'action_approve') ? [this.record.resId, false] : [this.record.resId]; await this.orm.call("hr.leave", action, args); this.props.onLeaveUpdated(); } get canApprove() { - return !this.model.root.isNew && (this.record.can_approve && ['confirm', 'refuse',].includes(this.record.state)); + return !this.model.root.isNew && (this.record.data.can_approve && ['confirm', 'refuse',].includes(this.record.data.state)); } get canValidate() { - return !this.model.root.isNew && (this.record.can_approve && this.record.state === 'validate1'); + return !this.model.root.isNew && (this.record.data.can_approve && this.record.data.state === 'validate1'); } get canRefuse() { - return !this.model.root.isNew && (this.record.can_approve && this.record.state && ['confirm', 'validate1', 'validate'].includes(this.record.state)); + return !this.model.root.isNew && (this.record.data.can_approve && this.record.data.state && ['confirm', 'validate1', 'validate'].includes(this.record.data.state)); } deleteRecord() { - this.props.onRecordDeleted(this.record) + this.props.onRecordDeleted(this.record.data) this.props.onCancelLeave(); - if (this.record.can_cancel) { - this.leaveCancelWizard(this.record.id, () => { + if (this.record.data.can_cancel) { + this.leaveCancelWizard(this.record.resId, () => { this.props.onLeaveCancelled(); }); } } get canDelete() { - return !this.model.root.isNew && (this.record.can_cancel || this.record.state && !['validate', 'refuse'].includes(this.record.state)); + return !this.model.root.isNew && (this.record.data.can_cancel || this.record.data.state && !['validate', 'refuse'].includes(this.record.data.state)); } }