Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
3804 Vues

I want to inherit the Job Application Form in hr.job odoo website and add a field.

Also, how do I override submit button function and add some functionality to it?

How do I use controllers or smth to go about this?
Any assistance will be highly appreciated.

Avatar
Ignorer

Jay, hope your last post is solved..
Regarding currnet one - Could you paste a link to a screenshot of the view you would like to modify?
you can use free image hosting to post image link
imgbb.com
I will answer but in a 3-4 hours.. I have a important meeting in a minute. See ya, Jay!

Auteur

I want to add a field under your phone number.
https://ibb.co/4KQvSqM


Ok, I will help you with it, but now not in the office ...
in 3 hours will be back! See you Jay, maybe until that time someone will help you :)

Sent from Mailspring
Auteur

Cool, looking forward to Krys

Auteur

In your own free time Krys.Raj.

Currently writing an answer, in 10 minutes it will be there...
Sent from Mailspring
Auteur

Cool.

The Answer editor is a disater, when you pasting the links and editing code.. :(
Comments works quite well in the opposite. Ok, that's the answer for now. Got to go!

Sent from Mailspring
Meilleure réponse

Hello Jay,
First you need to know what template you are going to modify
https://github.com/odoo/odoo/blob/e2788b580ef15ef3083ac919737a46d850143832/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml#L131
look since 131 line - you got the "apply" template. Now your job is to inherit it, and tell with xpath what to do (add/remove/modify) so... to add a field there you first need to know the field name (if it exists) or create one if you need it.

Then tell with xpath to insert the additional block of your custom code including your field, respecting the template structure. To add a field after the phone number code will be like this:

<template id="user_navbar_inherit_website_hr_recruitment" inherit_id="website_hr_recruitment.apply">
<xpath expr="//form[@id='hr_recruitment_form']/div/div[3]" position="after">
<div class="form-group col-12 s_website_form_field s_website_form_required" data-type="char" data-name="Field">
<div class="row s_col_no_resize s_col_no_bgcolor">
<label class="col-form-label col-sm-auto s_website_form_label" style="width: 200px" for="recruitment8">
<span class="s_website_form_label_content">Your custom field</span>
<span class="s_website_form_mark"> *</span>
</label>
<div class="col-sm">
<input id="recruitment8" type="tel" class="form-control s_website_form_input" name="your_custom_field" required=""/>
</div>
</div>
</div>
</xpath>
</template>

PasteBin version: https://pastebin.com/kwjyNfsg

result link
https://ibb.co/0C9L0Wv

That's it about the form.

Regarding the data of the custom field .. please take a closer look at the right controller.
To find it first look where the Submit button will procees the form - URL (bottom left corner)
https://ibb.co/WN9J1PK

Now just find ther right controller check how it processes the data and modify by inheriting
controller is here:
https://github.com/odoo/odoo/blob/2e728f21bbc2771a8793d20e371f2fb7aea33e80/addons/website_hr_recruitment/controllers/main.py#L92

It's really to much to explain how to modify.. you need to be precise here. But in the weekend you can study a little bit.


Temporary, vote +1 if I helped. :)

Avatar
Ignorer
Auteur

wow, well explained Krys.Raj.
Going through it and will let you know in a minute how it goes.
Thanks a lot for taking your time to help.

Auteur

Working perfectly well, one last thing,
what if 'your_custom_field' is the Many2one field, where do I change to pull the data from db?

Auteur

Hi, Krys.Raj.

I want to inherit the recruitment job application page --> website https://ibb.co/tcCxBY7 and add survey questions from the survey module associated with the job position in Odoo 14 recruitment module.

I want to add the survey questions after the applicant submits their job application and before the applicant receives the congratulation message --> https://ibb.co/mzbk78J. This is because I want their survey to be associated with them i.e. their id.

How can I go about this?
Thank you for your assistance in advance.

Meilleure réponse

Sorry, i have some problem here. When my costume is Many2one field, i cannot see any data in online job form. And when submit data in online job form, field custom data from applicant odoo is not include

Avatar
Ignorer
Publications associées Réponses Vues Activité
3
août 23
4365
1
déc. 24
3663
0
juin 21
1787
2
mai 24
4646
0
févr. 22
2742