This question has been flagged
1 Reply
4092 Views

Hi, 


I have published available jobs on the website on OpenHRMS. When applying for the job, an application form opens which has some questions and option to attach resume.

Can I edit this form to have additional questions (like experience, CGPA etc) which will be stored in OpenHRMS backend?




Avatar
Discard
Best Answer

Hi

In the job application form, we need to customize the controller and the models in the hr. applicant model you can add the required field.

XML: Inherits the application templates and we can add the required fields based on these divs

<template id="apply_job_custom" name="Apply For job Inherit"
inherit_id="website_hr_recruitment.apply">
<xpath expr="//form/div[hasclass('s_website_form_rows')]"
                   position="replace">
                <form id="hr_recruitment_form" action="/website_form/"
                      method="post" enctype="multipart/form-data"
                      class="o_mark_required" data-mark="*"
                      data-model_name="hr.applicant"
                      data-success-mode="redirect"
data-success-page="/job-thank-you"
                      hide-change-model="true">
                    <div name="application_form"
                         class="s_website_form_rows row s_col_no_bgcolor o_survey_form">
                        <h3>Profile Info</h3>
                        <hr/>
                       
                        <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="appli_field17">
<span class="s_website_form_label_content">
                                        Identification No
                                    </span>
                                    <span class="s_website_form_mark"
                                          style="color:red;">*
                                    </span>
                                </label>
                                <div class="col-sm">
                                    <input id="appli_field17" type="text"
                                           class="form-control s_website_form_input"
                                           name="identification" required=""/>
                                </div>
                            </div>
                        </div>
        </div>
          </form>

</xpath>
</template>

Controller:


class WebsiteFormCustom(WebsiteForm):
    """ we can add the education, certification, and work details
    in a model, we can use the function for mapping"""
   
    def insert_record(self, request, model, values, custom, meta=None):
        """ Inserting the values from the forms use the function """
        if model.model == 'hr.applicant':
     
applicant_id = super(WebsiteFormCustom, self).insert_record(request,model,values,custom,meta=None)
this_applicant_id = request.env['hr.applicant'].sudo().browse(
                applicant_id)
this_applicant_id.sudo().write({
                'partner_name': values['partner_name'] + values['last_name'],
                'first_name': values['partner_name'],
                'last_name': values['last_name'],
                'identification': values['identification'],

           
            return applicant_id

Hope it helps


Avatar
Discard