From 310d93cb1a15af54c182c4bfd8d350dfc64a1183 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Wed, 12 Aug 2015 13:00:33 +0200 Subject: [PATCH] [REM] hr_recruitment: Remaining old api res_config.py file Update new_api one also --- .../models/hr_recruitment_config_settings.py | 9 ++- addons/hr_recruitment/res_config.py | 57 ------------------- 2 files changed, 6 insertions(+), 60 deletions(-) delete mode 100644 addons/hr_recruitment/res_config.py diff --git a/addons/hr_recruitment/models/hr_recruitment_config_settings.py b/addons/hr_recruitment/models/hr_recruitment_config_settings.py index 76239c78d18..52575204b0d 100644 --- a/addons/hr_recruitment/models/hr_recruitment_config_settings.py +++ b/addons/hr_recruitment/models/hr_recruitment_config_settings.py @@ -8,9 +8,12 @@ class RecruitmentSettings(models.TransientModel): _name = 'hr.recruitment.config.settings' _inherit = ['res.config.settings', 'fetchmail.config.settings'] - module_document = fields.Boolean(string='Allow the automatic indexation of resumes', - help='Manage your CV\'s and motivation letter related to all applicants.\n' - '-This installs the module document_ftp. This will install the knowledge management module in order to allow you to search using specific keywords through the content of all documents (PDF, .DOCx...)') + module_document = fields.Selection(selection=[ + (0, "Do not manage CVs and motivation letter"), + (1, 'Allow the automatic indexation of resumes') + ], string='Resumes', + help='Manage your CV\'s and motivation letter related to all applicants.\n' + '-This installs the module document_ftp. This will install the knowledge management module in order to allow you to search using specific keywords through the content of all documents (PDF, .DOCx...)') alias_prefix = fields.Char(string='Default Alias Name for Jobs') alias_domain = fields.Char(string='Alias Domain', default=lambda self: self.env["ir.config_parameter"].get_param("mail.catchall.domain")) diff --git a/addons/hr_recruitment/res_config.py b/addons/hr_recruitment/res_config.py deleted file mode 100644 index ddb2ecee27a..00000000000 --- a/addons/hr_recruitment/res_config.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from openerp import SUPERUSER_ID -from openerp.osv import fields, osv - - -class hr_applicant_settings(osv.TransientModel): - _name = 'hr.recruitment.config.settings' - _inherit = ['res.config.settings', 'fetchmail.config.settings'] - - _columns = { - 'module_document': fields.selection([ - (0, "Do not manage CVs and motivation letter"), - (1, 'Allow the automatic indexation of resumes') - ], "Resumes", - help='Manage your CV\'s and motivation letter related to all applicants.\n' - '-This installs the module document_ftp. This will install the knowledge management module in order to allow you to search using specific keywords through the content of all documents (PDF, .DOCx...)'), - 'alias_prefix': fields.char('Default Alias Name for Jobs'), - 'alias_domain': fields.char('Alias Domain'), - } - - _defaults = { - 'alias_domain': lambda self, cr, uid, context: self.pool["ir.config_parameter"].get_param(cr, uid, "mail.catchall.domain", context=context), - } - - def _find_default_job_alias_id(self, cr, uid, context=None): - alias_id = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'hr_recruitment.mail_alias_jobs') - if not alias_id: - alias_ids = self.pool['mail.alias'].search( - cr, uid, [ - ('alias_model_id.model', '=', 'hr.applicant'), - ('alias_force_thread_id', '=', False), - ('alias_parent_model_id.model', '=', 'hr.job'), - ('alias_parent_thread_id', '=', False), - ('alias_defaults', '=', '{}') - ], context=context) - alias_id = alias_ids and alias_ids[0] or False - return alias_id - - def get_default_alias_prefix(self, cr, uid, ids, context=None): - alias_name = False - alias_id = self._find_default_job_alias_id(cr, uid, context=context) - if alias_id: - alias_name = self.pool['mail.alias'].browse(cr, uid, alias_id, context=context).alias_name - return {'alias_prefix': alias_name} - - def set_default_alias_prefix(self, cr, uid, ids, context=None): - mail_alias = self.pool.get('mail.alias') - for record in self.browse(cr, uid, ids, context=context): - alias_id = self._find_default_job_alias_id(cr, uid, context=context) - if not alias_id: - create_ctx = dict(context, alias_model_name='hr.applicant', alias_parent_model_name='hr.job') - alias_id = self.pool['mail.alias'].create(cr, uid, {'alias_name': record.alias_prefix}, context=create_ctx) - else: - mail_alias.write(cr, uid, alias_id, {'alias_name': record.alias_prefix}, context=context) - return True