[IMP] hr_recruitment_survey: add recruitment survey category

Purpose of this commit is to add a new survey category for applicants. That
way surveys created and/or used through recruitment process are correctly
set in their own category allowing to filter them. When creating a new
recruitment only surveys linked to recruitment process are shown. Moreover
default values are propagated when creating new surveys so that they are
correctly configured by default as recruitment and invite-only surveys.

This commit is linked to task ID 1911586 and PR #28986.
This commit is contained in:
Thibault Delavallée
2019-01-14 15:22:18 +00:00
parent f15861c36d
commit a8a6729eed
7 changed files with 31 additions and 3 deletions
@@ -14,6 +14,7 @@
'security/hr_recruitment_survey_security.xml',
'views/hr_job_views.xml',
'views/hr_applicant_views.xml',
'views/survey_survey_views.xml',
'views/res_config_setting_views.xml',
],
'demo': [
@@ -4,6 +4,7 @@
<field name="title">Recruitment Form</field>
<field name="stage_id" ref="survey.stage_permanent"/>
<field name="access_mode">token</field>
<field name="category">hr_recruitment</field>
<field name="users_can_go_back" eval="True"/>
<field name="description" type="html">
<p>
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import hr_job
from . import hr_applicant
from . import survey_survey
@@ -8,6 +8,7 @@ class Job(models.Model):
survey_id = fields.Many2one(
'survey.survey', "Interview Form",
domain=[('category', '=', 'hr_recruitment')],
help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job")
@api.multi
@@ -0,0 +1,9 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class Survey(models.Model):
_inherit = 'survey.survey'
category = fields.Selection(selection_add=[('hr_recruitment', 'Recruitment')])
@@ -6,9 +6,10 @@
<field name="inherit_id" ref="hr_recruitment.hr_job_survey"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='address_id']" position="before">
<label for="survey_id" groups="base.group_user"/>
<div groups="base.group_user" class="o_row">
<field name="survey_id"/>
<label for="survey_id" groups="survey.group_survey_user"/>
<div groups="survey.group_survey_user" class="o_row">
<field name="survey_id"
context="{'default_category': 'hr_recruitment', 'default_access_mode': 'token'}"/>
<button string="Display Interview Form" name="action_print_survey" type="object" attrs="{'invisible':[('survey_id','=',False)]}" class="oe_link"/>
</div>
</xpath>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo><data>
<record id="survey_survey_view_form" model="ir.ui.view">
<field name="name">survey.survey.view.form.inherit.hr_recruitment</field>
<field name="model">survey.survey</field>
<field name="inherit_id" ref="survey.survey_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='category']" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
</field>
</record>
</data></odoo>