[MRG]merge with lp:~openerp-dev/openobject-addons/trunk-mail-alias-jam
[odoo/odoo.git] / addons / mail / res_config.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
6 #
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.
11 #
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.
16 #
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/>
19 #
20 ##############################################################################
21
22 from openerp.osv import osv, fields
23
24 class project_configuration(osv.TransientModel):
25     _inherit = 'base.config.settings'
26
27     _columns = {
28         'alias_domain' : fields.char('Catch-all Mail Alias Domain', size=None,
29                                      help="If you have setup a catch-all mail domain redirected to "
30                                           "the OpenERP server, enter the domain name here."),
31     }
32
33     def get_default_alias_domain(self, cr, uid, ids, context=None):
34         return {'alias_domain': self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)}
35
36     def set_alias_domain(self, cr, uid, ids, context=None):
37         config_parameters = self.pool.get("ir.config_parameter")
38         for record in self.browse(cr, uid, ids, context=context):
39             config_parameters.set_param(cr, uid, "mail.catchall.domain", record.alias_domain or '', context=context)