[FIX] website_hr_recruitment: fix legacy _rpc

Behavior before this commit:
When you try to apply for a job on focusout of the mail field, you get
an error raised in website stating that this._rpc is not a function.

Explanation:
The task 3446696 (PR: 131308) has been merged in master
at almost the same time as the task 3439226 (PR: 136271)
that was removing the legacy rpc call (this._rpc({...})).

Behavior after this commit:
The rpc call is working again and so no error is raised.

Fix:
This commit fix it by using the current
rpc call.

closes odoo/odoo#137822

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
This commit is contained in:
Flotchet
2023-10-09 09:33:50 +00:00
parent 8b7f1c892b
commit a7fcb0ccf7
@@ -13,6 +13,7 @@ publicWidget.registry.hrRecruitment = publicWidget.Widget.extend({
init: function () {
this._super.apply(this, arguments);
this.rpc = this.bindService("rpc");
},
willStart() {
@@ -60,13 +61,11 @@ publicWidget.registry.hrRecruitment = publicWidget.Widget.extend({
return;
}
const job_id = $('#recruitment7').val();
const data = await this._rpc({
route: '/website_hr_recruitment/check_recent_application',
params: {
const data = await this.rpc('/website_hr_recruitment/check_recent_application',
{
email: email,
job_id: job_id,
}
});
});
if (data.applied_same_job) {
$('#email-message').removeClass('alert-warning').hide();
$(ev.currentTarget).addClass('border-warning');