2012-04-02 05:44:18 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
2012-04-10 09:56:42 +00:00
|
|
|
# OpenERP, Open Source Business Applications
|
|
|
|
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
|
2012-04-02 05:44:18 +00:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2012-12-06 14:56:32 +00:00
|
|
|
from openerp.osv import fields, osv
|
2012-04-02 05:44:18 +00:00
|
|
|
|
|
|
|
class hr_applicant_settings(osv.osv_memory):
|
2012-04-10 10:56:32 +00:00
|
|
|
_name = 'hr.config.settings'
|
|
|
|
_inherit = ['hr.config.settings', 'fetchmail.config.settings']
|
2012-04-02 05:44:18 +00:00
|
|
|
|
|
|
|
_columns = {
|
2012-09-12 11:37:49 +00:00
|
|
|
'module_document_ftp': fields.boolean('Allow the automatic indexation of resumes',
|
2012-04-10 11:52:19 +00:00
|
|
|
help="""Manage your CV's and motivation letter related to all applicants.
|
2012-05-30 13:46:13 +00:00
|
|
|
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...)"""),
|
2012-09-12 11:37:49 +00:00
|
|
|
'fetchmail_applicants': fields.boolean('Create applicants from an incoming email account',
|
2012-06-09 17:27:57 +00:00
|
|
|
fetchmail_model='hr.applicant', fetchmail_name='Incoming HR Applications',
|
2012-04-10 11:52:19 +00:00
|
|
|
help ="""Allow applicants to send their job application to an email address (jobs@mycompany.com),
|
|
|
|
and create automatically application documents in the system."""),
|
2013-05-27 13:32:37 +00:00
|
|
|
'alias_prefix': fields.char('Default Alias Name for Jobs'),
|
|
|
|
'alias_domain' : fields.char('Alias Domain'),
|
2012-04-02 05:44:18 +00:00
|
|
|
}
|
|
|
|
|
2013-05-27 13:32:37 +00:00
|
|
|
def get_default_alias_prefix(self, cr, uid, ids, context=None):
|
|
|
|
alias_name = ''
|
|
|
|
mail_alias = self.pool.get('mail.alias')
|
2013-05-28 13:31:43 +00:00
|
|
|
alias = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_recruitment', 'mail_alias_jobs')
|
|
|
|
if alias:
|
|
|
|
alias_name = alias.alias_name
|
2013-05-27 13:32:37 +00:00
|
|
|
return {'alias_prefix': alias_name}
|
|
|
|
|
|
|
|
def set_default_alias_prefix(self, cr, uid, ids, context=None):
|
|
|
|
mail_alias = self.pool.get('mail.alias')
|
|
|
|
record = self.browse(cr, uid, ids[0], context=context)
|
|
|
|
if record.alias_prefix:
|
2013-05-28 13:31:43 +00:00
|
|
|
alias = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_recruitment', 'mail_alias_jobs')
|
|
|
|
if alias:
|
|
|
|
alias.write({'alias_name': record.alias_prefix})
|
2013-05-27 13:32:37 +00:00
|
|
|
else:
|
|
|
|
mail_alias.create_unique_alias(cr, uid, {'alias_name': record.alias_prefix}, model_name="hr.applicant", context=context)
|
|
|
|
|
|
|
|
def get_default_alias_domain(self, cr, uid, ids, context=None):
|
|
|
|
alias_domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)
|
|
|
|
if not alias_domain:
|
|
|
|
domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "web.base.url", context=context)
|
|
|
|
try:
|
|
|
|
alias_domain = urlparse.urlsplit(domain).netloc.split(':')[0]
|
|
|
|
except Exception:
|
|
|
|
pass
|
|
|
|
return {'alias_domain': alias_domain}
|