| 1 |
|
| 2 |
|
| 3 |
from odoo import fields, models, _ |
| 4 |
|
| 5 |
|
| 6 |
class HrJob(models.Model): |
| 7 |
_inherit = "hr.job" |
| 8 |
|
| 9 |
survey_id = fields.Many2one( |
| 10 |
'survey.survey', "Interview Form", index='btree_not_null', |
| 11 |
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") |
| 12 |
|
| 13 |
def action_test_survey(self): |
| 14 |
self.ensure_one() |
| 15 |
action = self.survey_id.action_test_survey() |
| 16 |
return action |
| 17 |
|
| 18 |
def action_new_survey(self): |
| 19 |
self.ensure_one() |
| 20 |
survey = self.env['survey.survey'].create({ |
| 21 |
'title': _("Interview Form: %s", self.name), |
| 22 |
}) |
| 23 |
self.write({'survey_id': survey.id}) |
| 24 |
|
| 25 |
action = { |
| 26 |
'name': _('Survey'), |
| 27 |
'view_mode': 'form,list', |
| 28 |
'res_model': 'survey.survey', |
| 29 |
'type': 'ir.actions.act_window', |
| 30 |
'res_id': survey.id, |
| 31 |
} |
| 32 |
|
| 33 |
return action |