SHARE
TWEET

Untitled

a guest Nov 19th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3.  
  4. import json
  5. import logging
  6. from odoo import http, _
  7. from odoo.addons.http_routing.models.ir_http import slug
  8. from odoo.http import request
  9. from werkzeug.exceptions import NotFound
  10. import werkzeug.exceptions
  11. import werkzeug.urls
  12. import werkzeug.wrappers
  13. from odoo.addons.website_hr_recruitment.controllers.main import WebsiteHrRecruitment
  14. from odoo.addons.website_form.controllers.main import WebsiteForm
  15. from odoo.addons.survey.controllers.main import *
  16. from odoo.addons.http_routing.models.ir_http import slug
  17.  
  18. _logger = logging.getLogger(__name__)
  19.  
  20. class WebsiteForm(WebsiteForm):
  21.  
  22.     def insert_record(self, request, model, values, custom, meta=None):
  23.         if model.model == 'hr.applicant':
  24.             if 'response_id' not in values:
  25.                 for jjj in tuple(request.params.get('job_id')):
  26.                     jj = int(jjj)
  27.                 jobb = request.env['hr.job'].sudo().search([('id','=',jj)])
  28.                 if jobb.survey_id:
  29.                     current_user = request.env['res.users'].sudo().browse(request.uid)
  30.                     partner = current_user.partner_id.id
  31.                     email = current_user.partner_id.email
  32.                     user_input = request.env['survey.user_input'].sudo().create({'survey_id': jobb.survey_id.id,'partner_id':partner,'email':email,'test_entry': True})
  33.                     values['response_id'] = answer_sudo.id
  34.         return super().insert_record(request, model, values, custom, meta=meta)
  35.  
  36. <?xml version="1.0" encoding="utf-8"?>
  37. <odoo>
  38.  
  39.     <template id="app_hr_survey" inherit_id="website_hr_recruitment.thankyou_ir_ui_view">
  40.         <xpath expr="//div[@id='o_recruitment_thank_cta']" position="replace">
  41.             <t t-set="job" t-value="request.website._website_form_last_record().sudo().job_id"/>
  42.             <div class="row" id="o_recruitment_thank_cta" t-if="not job.survey_id">
  43.                                     <div class="col-lg-12 text-center mt32 mb32">
  44.                                         In the meantime,
  45.                                         <h3 class="mt8 mb32">Look around on our website:</h3>
  46.                                         <a role="button" href="/" class="btn btn-primary btn-lg">Continue To Our Website</a>
  47.                                     </div>
  48.             </div>
  49.             <div class="row" id="o_recruitment_thank_surv" t-if="job.survey_id">
  50.                 <div class="col-lg-12 text-center mt32 mb32" t-if="job.survey_id">
  51.                     <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>
  52.                 </div>
  53.             </div>
  54.         </xpath>
  55.     </template>
  56.  
  57. </odoo>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top