From 8444c463f88c30e020feb59b89104feeb61d0332 Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Tue, 7 Mar 2023 10:44:31 +0000 Subject: [PATCH] [FIX] hr_recruitment: hide chatter button for interviewers Steps to reproduce: - install hr_referral to have the group "group_hr_recruitment_referral_user"; - with a user, check "Recruitment Interviewer" (to access the Recruitment application); - with the same user, put the person as interviewer; - checked/uncheck the "Display CV on application form" parameter on the user; Issue: Depending on whether the CV is displayed or not, the display of the buttons differs in the chatter on the form view of a job application. Cause: The "hr_applicant_view_form_interviewer" view allows to hide the buttons only when the chatter is contained in the form container. Solution: Add the class that allows to hide the information with an override of the FormController component. opw-3202343 closes odoo/odoo#115828 X-original-commit: 878289c30d3bc0c24d0f01b20dd6a640b181c3b0 Signed-off-by: Kevin Baptiste Signed-off-by: Lefebvre Thomas (thle) --- .../static/src/views/form_view.js | 28 +++++++++++++++++++ .../views/hr_applicant_views.xml | 3 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 addons/hr_recruitment/static/src/views/form_view.js diff --git a/addons/hr_recruitment/static/src/views/form_view.js b/addons/hr_recruitment/static/src/views/form_view.js new file mode 100644 index 00000000000..60d4a971b8a --- /dev/null +++ b/addons/hr_recruitment/static/src/views/form_view.js @@ -0,0 +1,28 @@ +/** @odoo-module */ + +import { registry } from '@web/core/registry'; + +import { formView } from '@web/views/form/form_view'; +import { FormController } from '@web/views/form/form_controller'; + +export class InterviewerFormController extends FormController { + + /** + * Add `o_applicant_interviewer_form` class if necessary + */ + get className() { + const result = super.className; + const root = this.model.root; + if (!root.data.interviewer_ids || !root.data.user_id) { + return result; + } + result["o_applicant_interviewer_form"] = root.data.interviewer_ids.records.findIndex( + interviewer => interviewer.data.id === root.data.user_id[0]) > -1; + return result; + } +} + +registry.category('views').add('hr_recruitment_interviewer', { + ...formView, + Controller: InterviewerFormController, +}); diff --git a/addons/hr_recruitment/views/hr_applicant_views.xml b/addons/hr_recruitment/views/hr_applicant_views.xml index 3f59ce9d0e4..424fefef76b 100644 --- a/addons/hr_recruitment/views/hr_applicant_views.xml +++ b/addons/hr_recruitment/views/hr_applicant_views.xml @@ -181,7 +181,8 @@ primary - o_applicant_form o_applicant_interviewer_form + hr_recruitment_interviewer + o_applicant_form