[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 <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2023-03-20 15:31:54 +01:00
parent 146e1fb617
commit 8444c463f8
2 changed files with 30 additions and 1 deletions
@@ -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,
});
@@ -181,7 +181,8 @@
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//form" position="attributes">
<attribute name="class">o_applicant_form o_applicant_interviewer_form</attribute>
<attribute name="js_class">hr_recruitment_interviewer</attribute>
<attribute name="class">o_applicant_form</attribute>
</xpath>
<xpath expr="//group[@name='recruitment_contract']" position="replace"/>
</field>