Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # Part of Odoo. See LICENSE file for full copyright and licensing details.
- import json
- import logging
- from odoo import http, _
- from odoo.addons.http_routing.models.ir_http import slug
- from odoo.http import request
- from werkzeug.exceptions import NotFound
- import werkzeug.exceptions
- import werkzeug.urls
- import werkzeug.wrappers
- from odoo.addons.website_hr_recruitment.controllers.main import WebsiteHrRecruitment
- from odoo.addons.website_form.controllers.main import WebsiteForm
- from odoo.addons.survey.controllers.main import *
- from odoo.addons.http_routing.models.ir_http import slug
- _logger = logging.getLogger(__name__)
- class WebsiteForm(WebsiteForm):
- def insert_record(self, request, model, values, custom, meta=None):
- if model.model == 'hr.applicant':
- if 'response_id' not in values:
- for jjj in tuple(request.params.get('job_id')):
- jj = int(jjj)
- jobb = request.env['hr.job'].sudo().search([('id','=',jj)])
- if jobb.survey_id:
- current_user = request.env['res.users'].sudo().browse(request.uid)
- partner = current_user.partner_id.id
- email = current_user.partner_id.email
- user_input = request.env['survey.user_input'].sudo().create({'survey_id': jobb.survey_id.id,'partner_id':partner,'email':email,'test_entry': True})
- values['response_id'] = answer_sudo.id
- return super().insert_record(request, model, values, custom, meta=meta)
- <?xml version="1.0" encoding="utf-8"?>
- <odoo>
- <template id="app_hr_survey" inherit_id="website_hr_recruitment.thankyou_ir_ui_view">
- <xpath expr="//div[@id='o_recruitment_thank_cta']" position="replace">
- <t t-set="job" t-value="request.website._website_form_last_record().sudo().job_id"/>
- <div class="row" id="o_recruitment_thank_cta" t-if="not job.survey_id">
- <div class="col-lg-12 text-center mt32 mb32">
- In the meantime,
- <h3 class="mt8 mb32">Look around on our website:</h3>
- <a role="button" href="/" class="btn btn-primary btn-lg">Continue To Our Website</a>
- </div>
- </div>
- <div class="row" id="o_recruitment_thank_surv" t-if="job.survey_id">
- <div class="col-lg-12 text-center mt32 mb32" t-if="job.survey_id">
- <a role="button" class="btn btn-primary btn-lg" t-att-href="'/survey/fill/%s/%s' % (job.survey_id.access_token,request.website._website_form_last_record().sudo().response_id.token)">Start Survey</a>
- </div>
- </div>
- </xpath>
- </template>
- </odoo>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement