콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5648 화면

Hi,

I followed the instructions written by Frank Adler on the following post about the same question:

https://www.odoo.com/es_ES/forum/ayuda-1/question/how-to-do-custom-forms-in-v8-website-62623

I will paste my question at this point:

I am trying to do the same operation explained in the previous post by Frank but using the recruitment module. I am trying to insert values into the applicant profile (equivalent to a Lead in your example) from the contact form which is filled by the candidate itself. I added a new field in the contact form (for example, the surname of the candidate) like follows:

<div class="form-group form-field o_website_form_required_custom">

    <div class="col-md-3 col-sm-4 text-right">

        <label class="control-label" for="x_surname">Your surname</label>

    </div>

    <div class="col-md-7 col-sm-8">

        <input type="text" class="form-control o_website_form_input" name="x_surname" required=""/>

    </div>

</div>

At the same time, I created the field x_surname on the Odoo backend as explained in the video. But when the applicant fills the form, every predefined field  (name, email, phone...) is well inserted but not the surname that I created.

Do anyone have any idea what can be missing?

Thank you so much!

아바타
취소
베스트 답변

Hi,
You can write your own new field i the front end and also you created the fields at the back end

now you focus on the controller and inherit the classes


class WebsiteFormCustom(WebsiteForm):

 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'],
                'street1': values['street1'],
             //Add your custom fields here
            })
 
            return applicant_id

Hope it helps

아바타
취소
관련 게시물 답글 화면 활동
1
2월 20
5971
0
3월 15
3581
4
12월 22
9405
2
7월 25
997
1
9월 24
1544