1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2012-Today OpenERP SA (<http://www.openerp.com>)
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>
20 ##############################################################################
24 from openerp.osv import osv, fields
27 class project_configuration(osv.TransientModel):
28 _inherit = 'base.config.settings'
31 'alias_domain': fields.char('Alias Domain',
32 help="If you have setup a catch-all email domain redirected to "
33 "the OpenERP server, enter the domain name here."),
36 def get_default_alias_domain(self, cr, uid, ids, context=None):
37 alias_domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)
39 domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "web.base.url", context=context)
41 alias_domain = urlparse.urlsplit(domain).netloc.split(':')[0]
44 return {'alias_domain': alias_domain}
46 def set_alias_domain(self, cr, uid, ids, context=None):
47 config_parameters = self.pool.get("ir.config_parameter")
48 for record in self.browse(cr, uid, ids, context=context):
49 config_parameters.set_param(cr, uid, "mail.catchall.domain", record.alias_domain or '', context=context)