From b3648ed9d816c911fd5f03aa8b9ca8218dda7d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Grand-Guillaume?= Date: Tue, 22 Nov 2011 09:48:20 +0100 Subject: [PATCH 01/52] [add] mail_environment --- mail_environment/__init__.py | 6 ++ mail_environment/__openerp__.py | 22 +++++ mail_environment/env_mail.py | 142 ++++++++++++++++++++++++++++++++ mail_environment/mail_view.xml | 28 +++++++ 4 files changed, 198 insertions(+) create mode 100644 mail_environment/__init__.py create mode 100644 mail_environment/__openerp__.py create mode 100644 mail_environment/env_mail.py create mode 100644 mail_environment/mail_view.xml diff --git a/mail_environment/__init__.py b/mail_environment/__init__.py new file mode 100644 index 000000000..beab69dc0 --- /dev/null +++ b/mail_environment/__init__.py @@ -0,0 +1,6 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Author Nicolas Bessi. Copyright Camptocamp SA +############################################################################## +from . import env_mail \ No newline at end of file diff --git a/mail_environment/__openerp__.py b/mail_environment/__openerp__.py new file mode 100644 index 000000000..3c74e2091 --- /dev/null +++ b/mail_environment/__openerp__.py @@ -0,0 +1,22 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Author Nicolas Bessi. Copyright Camptocamp SA +############################################################################## +{ + 'name': 'Server env config for mail + fetchmail', + 'version': '0.1', + 'category': 'Tools', + 'description': """ + extend mail and fetch mail with server env + """, + 'author': 'Camptocamp', + 'website': 'http://openerp.camptocamp.com', + 'depends': ['mail', 'fetchmail', 'server_environment', 'server_environment_files', 'crm'], + 'init_xml': [], + 'update_xml': ['mail_view.xml'], + 'demo_xml': [], + 'installable': True, + 'active': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/mail_environment/env_mail.py b/mail_environment/env_mail.py new file mode 100644 index 000000000..a1f9b4268 --- /dev/null +++ b/mail_environment/env_mail.py @@ -0,0 +1,142 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Author Nicolas Bessi. Copyright Camptocamp SA +############################################################################## +from osv import fields +from osv import osv + +from server_environment import serv_config + + +class IRMAIL(osv.osv): + _inherit = "ir.mail_server" + + def _get_smtp_conf(self, cursor, uid, ids, name, args, context=None): + """ + Return configuration + """ + res = {} + for conf in self.browse(cursor, uid, ids): + res_dict = dict(serv_config.items('outgoing_mail')) + res_dict['smtp_port'] = int(res_dict.get('smtp_port', 587)) + res[conf.id] = res_dict + return res + + _columns = { + 'smtp_host': fields.function(_get_smtp_conf, + method=True, + string='SMTP Server', + type="char", + multi='smtp_host', + size=128), + 'smtp_port': fields.function(_get_smtp_conf, + method=True, + string='SMTP Port', + type="integer", + multi='smtp_port', + help="SMTP Port. Usually 465 for SSL, and 25 or 587 for other cases.", + size=5), + 'smtp_user': fields.function(_get_smtp_conf, + method=True, + string='Username', + type="char", + multi='smtp_user', + help="Optional username for SMTP authentication", + size=64), + 'smtp_pass': fields.function(_get_smtp_conf, + method=True, + string='Password', + type="char", + multi='smtp_pass', + help="Optional password for SMTP authentication", + size=64), + 'smtp_encryption' :fields.function(_get_smtp_conf, + method=True, + string='smtp_encryption', + type="char", + multi='smtp_encryption', + help="Choose the connection encryption scheme:\n" + "- none: SMTP sessions are done in cleartext.\n" + "- starttls: TLS encryption is requested at start of SMTP session (Recommended)\n" + "- ssl: SMTP sessions are encrypted with SSL/TLS through a dedicated port (default: 465)", + size=64)} + +IRMAIL() + + +class FetchmailServer(osv.osv): + """Incoming POP/IMAP mail server account""" + _inherit = 'fetchmail.server' + + def _get_incom_conf(self, cursor, uid, ids, name, args, context=None): + """ + Return configuration + """ + res = {} + + for conf in self.browse(cursor, uid, ids): + res_dict = dict(serv_config.items('incoming_mail')) + res_dict['port'] = int(res_dict.get('port', 993)) + res_dict['is_ssl'] = bool(int(res_dict.get('is_ssl', 0))) + res_dict['attach'] = bool(int(res_dict.get('attach', 0))) + res_dict['original'] = bool(int(res_dict.get('original', 0))) + res[conf.id] = res_dict + return res + + _columns = { + 'server': fields.function(_get_incom_conf, + method=True, + string='Server', + type="char", + multi='server', + size=256, help="Hostname or IP of the mail server"), + 'port': fields.function(_get_incom_conf, + method=True, + string='Port', + type="integer", + multi='port', + help="Hostname or IP of the mail server"), + 'type': fields.function(_get_incom_conf, + method=True, + string='Type', + type="char", + multi='type', + size=64, + help="pop, imap, local"), + 'is_ssl': fields.function(_get_incom_conf, + method=True, + string='Is SSL', + type="boolean", + multi='is_ssl', + help='Connections are encrypted with SSL/TLS through' + ' a dedicated port (default: IMAPS=993, POP3S=995)'), + 'attach': fields.function(_get_incom_conf, + method=True, + string='Keep Attachments', + type="boolean", + multi='attach', + help="Whether attachments should be downloaded. " + "If not enabled, incoming emails will be stripped of any attachments before being processed"), + 'original': fields.function(_get_incom_conf, + method=True, + string='Keep Original', + type="boolean", + multi='attach', + help="Whether a full original copy of each email should be kept for reference" + "and attached to each processed message. This will usually double the size of your message database."), + 'user': fields.function(_get_incom_conf, + method=True, + string='Username', + type="char", + multi='user', + size=64), + 'password': fields.function(_get_incom_conf, + method=True, + string='password', + type="char", + multi='password', + size=64)} +FetchmailServer() + + \ No newline at end of file diff --git a/mail_environment/mail_view.xml b/mail_environment/mail_view.xml new file mode 100644 index 000000000..2a93a2dfa --- /dev/null +++ b/mail_environment/mail_view.xml @@ -0,0 +1,28 @@ + + + + + + inherit_fetchmail_for_env_support + fetchmail.server + + + + form + + + + + + + + + + + + + + + + + \ No newline at end of file From defa33d1a23b17a4f0686553fd004666611250d4 Mon Sep 17 00:00:00 2001 From: "@" <@> Date: Tue, 22 Nov 2011 10:45:49 +0100 Subject: [PATCH 02/52] [IMP] mail_environment misc --- mail_environment/__init__.py | 7 +-- mail_environment/__openerp__.py | 51 +++++++++++++++- mail_environment/env_mail.py | 104 ++++++++++++++++++++++---------- 3 files changed, 122 insertions(+), 40 deletions(-) diff --git a/mail_environment/__init__.py b/mail_environment/__init__.py index beab69dc0..be0b4da9a 100644 --- a/mail_environment/__init__.py +++ b/mail_environment/__init__.py @@ -1,6 +1 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Author Nicolas Bessi. Copyright Camptocamp SA -############################################################################## -from . import env_mail \ No newline at end of file +from . import env_mail diff --git a/mail_environment/__openerp__.py b/mail_environment/__openerp__.py index 3c74e2091..fce396f8d 100644 --- a/mail_environment/__openerp__.py +++ b/mail_environment/__openerp__.py @@ -1,16 +1,61 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # -# Author Nicolas Bessi. Copyright Camptocamp SA +# Author: Nicolas Bessi +# Copyright 2012 Camptocamp SA +# +# 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 . +# ############################################################################## + { 'name': 'Server env config for mail + fetchmail', 'version': '0.1', 'category': 'Tools', 'description': """ - extend mail and fetch mail with server env +Extend mail and fetch mail with server environment module. + +In config files, sections outgoint_mail and incoming_mails are default values for all Outgoing Mail Servers and Fetchmail Servers. +For each server, you can (re)define values with a section named "outgoing_mail.resource_name" where resource_name is the name of your server. + +Exemple of config file : + +[outgoing_mail] +smtp_host = smtp.myserver.com +smtp_port = 587 +smtp_user = +smtp_pass = +smtp_encryption = ssl + +[outgoing_mail.openerp_smtp_server1] +smtp_user = openerp +smtp_pass = openerp + +[incoming_mail.openerp_pop_mail1] +server = mail.myserver.com +port = 110 +type = pop +is_ssl = 0 +attach = 0 +original = 0 +user = openerp@myserver.com +password = openerp + + """, 'author': 'Camptocamp', + 'license': 'AGPL-3', 'website': 'http://openerp.camptocamp.com', 'depends': ['mail', 'fetchmail', 'server_environment', 'server_environment_files', 'crm'], 'init_xml': [], diff --git a/mail_environment/env_mail.py b/mail_environment/env_mail.py index a1f9b4268..59d5f5fe9 100644 --- a/mail_environment/env_mail.py +++ b/mail_environment/env_mail.py @@ -1,15 +1,31 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # -# Author Nicolas Bessi. Copyright Camptocamp SA +# Author: Nicolas Bessi +# Copyright 2012 Camptocamp SA +# +# 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 . +# ############################################################################## + from osv import fields from osv import osv from server_environment import serv_config -class IRMAIL(osv.osv): +class IrMail(osv.osv): _inherit = "ir.mail_server" def _get_smtp_conf(self, cursor, uid, ids, name, args, context=None): @@ -17,10 +33,22 @@ def _get_smtp_conf(self, cursor, uid, ids, name, args, context=None): Return configuration """ res = {} - for conf in self.browse(cursor, uid, ids): - res_dict = dict(serv_config.items('outgoing_mail')) - res_dict['smtp_port'] = int(res_dict.get('smtp_port', 587)) - res[conf.id] = res_dict + for mail_server in self.browse(cursor, uid, ids): + global_section_name = 'outgoing_mail' + + # default vals + config_vals = {'smtp_port': 587} + if serv_config.has_section(global_section_name): + config_vals.update((serv_config.items(global_section_name))) + + custom_section_name = '.'.join((global_section_name, mail_server.name)) + if serv_config.has_section(custom_section_name): + config_vals.update(serv_config.items(custom_section_name)) + + if config_vals.get('smtp_port'): + config_vals['smtp_port'] = int(config_vals['smtp_port']) + + res[mail_server.id] = config_vals return res _columns = { @@ -28,41 +56,41 @@ def _get_smtp_conf(self, cursor, uid, ids, name, args, context=None): method=True, string='SMTP Server', type="char", - multi='smtp_host', + multi='outgoing_mail_config', size=128), 'smtp_port': fields.function(_get_smtp_conf, method=True, string='SMTP Port', type="integer", - multi='smtp_port', + multi='outgoing_mail_config', help="SMTP Port. Usually 465 for SSL, and 25 or 587 for other cases.", size=5), 'smtp_user': fields.function(_get_smtp_conf, method=True, string='Username', type="char", - multi='smtp_user', + multi='outgoing_mail_config', help="Optional username for SMTP authentication", size=64), 'smtp_pass': fields.function(_get_smtp_conf, method=True, string='Password', type="char", - multi='smtp_pass', + multi='outgoing_mail_config', help="Optional password for SMTP authentication", size=64), 'smtp_encryption' :fields.function(_get_smtp_conf, method=True, string='smtp_encryption', type="char", - multi='smtp_encryption', + multi='outgoing_mail_config', help="Choose the connection encryption scheme:\n" "- none: SMTP sessions are done in cleartext.\n" "- starttls: TLS encryption is requested at start of SMTP session (Recommended)\n" "- ssl: SMTP sessions are encrypted with SSL/TLS through a dedicated port (default: 465)", size=64)} -IRMAIL() +IrMail() class FetchmailServer(osv.osv): @@ -74,14 +102,30 @@ def _get_incom_conf(self, cursor, uid, ids, name, args, context=None): Return configuration """ res = {} - - for conf in self.browse(cursor, uid, ids): - res_dict = dict(serv_config.items('incoming_mail')) - res_dict['port'] = int(res_dict.get('port', 993)) - res_dict['is_ssl'] = bool(int(res_dict.get('is_ssl', 0))) - res_dict['attach'] = bool(int(res_dict.get('attach', 0))) - res_dict['original'] = bool(int(res_dict.get('original', 0))) - res[conf.id] = res_dict + for fetchmail in self.browse(cursor, uid, ids): + global_section_name = 'incoming_mail' + + key_types = {'port': int, + 'is_ssl': lambda a: bool(int(a)), + 'attach': lambda a: bool(int(a)), + 'original': lambda a: bool(int(a)),} + + # default vals + config_vals = {'port': 993, + 'is_ssl': 0, + 'attach': 0, + 'original': 0} + if serv_config.has_section(global_section_name): + config_vals.update(serv_config.items(global_section_name)) + + custom_section_name = '.'.join((global_section_name, fetchmail.name)) + if serv_config.has_section(custom_section_name): + config_vals.update(serv_config.items(custom_section_name)) + + for key, to_type in key_types.iteritems(): + if config_vals.get(key): + config_vals[key] = to_type(config_vals[key]) + res[fetchmail.id] = config_vals return res _columns = { @@ -89,54 +133,52 @@ def _get_incom_conf(self, cursor, uid, ids, name, args, context=None): method=True, string='Server', type="char", - multi='server', + multi='income_mail_config', size=256, help="Hostname or IP of the mail server"), 'port': fields.function(_get_incom_conf, method=True, string='Port', type="integer", - multi='port', + multi='income_mail_config', help="Hostname or IP of the mail server"), 'type': fields.function(_get_incom_conf, method=True, string='Type', type="char", - multi='type', + multi='income_mail_config', size=64, help="pop, imap, local"), 'is_ssl': fields.function(_get_incom_conf, method=True, string='Is SSL', type="boolean", - multi='is_ssl', + multi='income_mail_config', help='Connections are encrypted with SSL/TLS through' ' a dedicated port (default: IMAPS=993, POP3S=995)'), 'attach': fields.function(_get_incom_conf, method=True, string='Keep Attachments', type="boolean", - multi='attach', + multi='income_mail_config', help="Whether attachments should be downloaded. " "If not enabled, incoming emails will be stripped of any attachments before being processed"), 'original': fields.function(_get_incom_conf, method=True, string='Keep Original', type="boolean", - multi='attach', + multi='income_mail_config', help="Whether a full original copy of each email should be kept for reference" "and attached to each processed message. This will usually double the size of your message database."), 'user': fields.function(_get_incom_conf, method=True, string='Username', type="char", - multi='user', + multi='income_mail_config', size=64), 'password': fields.function(_get_incom_conf, method=True, string='password', type="char", - multi='password', + multi='income_mail_config', size=64)} FetchmailServer() - - \ No newline at end of file From e8ded063c37209bb9085c26adafc8796fba90b7d Mon Sep 17 00:00:00 2001 From: Joel Grand-Guillaume Date: Fri, 8 Nov 2013 15:06:53 +0100 Subject: [PATCH 03/52] [FIX] Add fnct_search on type in order to avoid error when ir.cron run the fetch task --- mail_environment/env_mail.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mail_environment/env_mail.py b/mail_environment/env_mail.py index 59d5f5fe9..e5c8bb997 100644 --- a/mail_environment/env_mail.py +++ b/mail_environment/env_mail.py @@ -128,6 +128,29 @@ def _get_incom_conf(self, cursor, uid, ids, name, args, context=None): res[fetchmail.id] = config_vals return res + def _type_search(self, cr, uid, obj, name, args, context={}): + result_ids = [] + # read all incomming servers values + all_ids = self.search(cr, uid, [], context=context) + results = self.read(cr, uid, all_ids, ['id','type'], context=context) + args = args[:] + i = 0 + while i < len(args): + operator = args[i][1] + if operator == '=': + for res in results: + if (res['type'] == args[i][2]) and (res['id'] not in result_ids): + result_ids.append(res['id']) + elif operator == 'in': + for search_vals in args[i][2]: + for res in results: + if (res['type'] == search_vals) and (res['id'] not in result_ids): + result_ids.append(res['id']) + else: + continue + i += 1 + return [('id', 'in', result_ids)] + _columns = { 'server': fields.function(_get_incom_conf, method=True, @@ -146,6 +169,7 @@ def _get_incom_conf(self, cursor, uid, ids, name, args, context=None): string='Type', type="char", multi='income_mail_config', + fnct_search=_type_search, size=64, help="pop, imap, local"), 'is_ssl': fields.function(_get_incom_conf, From 6cf5b9a17620a05e40abe4a45c5cf4b7f5771773 Mon Sep 17 00:00:00 2001 From: Jose Morales Date: Sun, 16 Feb 2014 19:13:30 -0530 Subject: [PATCH 04/52] [IMP] 7.0 no view type required --- mail_environment/mail_view.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mail_environment/mail_view.xml b/mail_environment/mail_view.xml index 2a93a2dfa..59577ed21 100644 --- a/mail_environment/mail_view.xml +++ b/mail_environment/mail_view.xml @@ -8,7 +8,6 @@ - form @@ -25,4 +24,4 @@ - \ No newline at end of file + From 1e95ee74ddf68c337c9ee5a04b0a475fa7e3da3b Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Wed, 8 Oct 2014 11:30:14 +0200 Subject: [PATCH 05/52] mail_eniroment misc improvements * Move mail_environment in root folder * Use absolute imports for openerp and new Model classes * Use cr argument instead of cursor, propagate context * Update fields, remove deprecated 'method' argument, change 'states' otherwise the fields are not readonly (seems that the 'states' of the original field is kept. * Activate the installable flag * Indentation of the view with 2 spaces * Remove only the attrs attribute instead of redefining the whole field * pep8 * crm is not a dependency for mail_environment * Fix typo in manifest --- mail_environment/__init__.py | 1 + mail_environment/__openerp__.py | 15 +- mail_environment/env_mail.py | 254 +++++++++++++++++--------------- mail_environment/mail_view.xml | 45 +++--- 4 files changed, 171 insertions(+), 144 deletions(-) diff --git a/mail_environment/__init__.py b/mail_environment/__init__.py index be0b4da9a..89dd1478f 100644 --- a/mail_environment/__init__.py +++ b/mail_environment/__init__.py @@ -1 +1,2 @@ +# -*- coding: utf-8 -*- from . import env_mail diff --git a/mail_environment/__openerp__.py b/mail_environment/__openerp__.py index fce396f8d..05efe5717 100644 --- a/mail_environment/__openerp__.py +++ b/mail_environment/__openerp__.py @@ -26,15 +26,17 @@ 'description': """ Extend mail and fetch mail with server environment module. -In config files, sections outgoint_mail and incoming_mails are default values for all Outgoing Mail Servers and Fetchmail Servers. -For each server, you can (re)define values with a section named "outgoing_mail.resource_name" where resource_name is the name of your server. +In config files, sections outgoing_mail and incoming_mails are default values +for all Outgoing Mail Servers and Fetchmail Servers. +For each server, you can (re)define values with a section named +"outgoing_mail.resource_name" where resource_name is the name of your server. Exemple of config file : [outgoing_mail] smtp_host = smtp.myserver.com smtp_port = 587 -smtp_user = +smtp_user = smtp_pass = smtp_encryption = ssl @@ -57,11 +59,14 @@ 'author': 'Camptocamp', 'license': 'AGPL-3', 'website': 'http://openerp.camptocamp.com', - 'depends': ['mail', 'fetchmail', 'server_environment', 'server_environment_files', 'crm'], + 'depends': ['mail', + 'fetchmail', + 'server_environment', + 'server_environment_files', + ], 'init_xml': [], 'update_xml': ['mail_view.xml'], 'demo_xml': [], 'installable': True, 'active': False, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/mail_environment/env_mail.py b/mail_environment/env_mail.py index e5c8bb997..c4025340a 100644 --- a/mail_environment/env_mail.py +++ b/mail_environment/env_mail.py @@ -19,21 +19,20 @@ # ############################################################################## -from osv import fields -from osv import osv +from openerp.osv import orm, fields -from server_environment import serv_config +from openerp.addons.server_environment import serv_config -class IrMail(osv.osv): +class IrMail(orm.Model): _inherit = "ir.mail_server" - - def _get_smtp_conf(self, cursor, uid, ids, name, args, context=None): + + def _get_smtp_conf(self, cr, uid, ids, name, args, context=None): """ Return configuration """ res = {} - for mail_server in self.browse(cursor, uid, ids): + for mail_server in self.browse(cr, uid, ids, context=context): global_section_name = 'outgoing_mail' # default vals @@ -41,7 +40,8 @@ def _get_smtp_conf(self, cursor, uid, ids, name, args, context=None): if serv_config.has_section(global_section_name): config_vals.update((serv_config.items(global_section_name))) - custom_section_name = '.'.join((global_section_name, mail_server.name)) + custom_section_name = '.'.join((global_section_name, + mail_server.name)) if serv_config.has_section(custom_section_name): config_vals.update(serv_config.items(custom_section_name)) @@ -52,73 +52,85 @@ def _get_smtp_conf(self, cursor, uid, ids, name, args, context=None): return res _columns = { - 'smtp_host': fields.function(_get_smtp_conf, - method=True, - string='SMTP Server', - type="char", - multi='outgoing_mail_config', - size=128), - 'smtp_port': fields.function(_get_smtp_conf, - method=True, - string='SMTP Port', - type="integer", - multi='outgoing_mail_config', - help="SMTP Port. Usually 465 for SSL, and 25 or 587 for other cases.", - size=5), - 'smtp_user': fields.function(_get_smtp_conf, - method=True, - string='Username', - type="char", - multi='outgoing_mail_config', - help="Optional username for SMTP authentication", - size=64), - 'smtp_pass': fields.function(_get_smtp_conf, - method=True, - string='Password', - type="char", - multi='outgoing_mail_config', - help="Optional password for SMTP authentication", - size=64), - 'smtp_encryption' :fields.function(_get_smtp_conf, - method=True, - string='smtp_encryption', - type="char", - multi='outgoing_mail_config', - help="Choose the connection encryption scheme:\n" - "- none: SMTP sessions are done in cleartext.\n" - "- starttls: TLS encryption is requested at start of SMTP session (Recommended)\n" - "- ssl: SMTP sessions are encrypted with SSL/TLS through a dedicated port (default: 465)", - size=64)} - -IrMail() - - -class FetchmailServer(osv.osv): + 'smtp_host': fields.function( + _get_smtp_conf, + string='SMTP Server', + type="char", + multi='outgoing_mail_config', + states={'draft': [('readonly', True)]}, + help="Hostname or IP of SMTP server"), + 'smtp_port': fields.function( + _get_smtp_conf, + string='SMTP Port', + type="integer", + multi='outgoing_mail_config', + states={'draft': [('readonly', True)]}, + help="SMTP Port. Usually 465 for SSL, " + "and 25 or 587 for other cases.", + size=5), + 'smtp_user': fields.function( + _get_smtp_conf, + string='Username', + type="char", + multi='outgoing_mail_config', + states={'draft': [('readonly', True)]}, + help="Optional username for SMTP authentication", + size=64), + 'smtp_pass': fields.function( + _get_smtp_conf, + string='Password', + type="char", + multi='outgoing_mail_config', + states={'draft': [('readonly', True)]}, + help="Optional password for SMTP authentication", + size=64), + 'smtp_encryption': fields.function( + _get_smtp_conf, + string='smtp_encryption', + type="selection", + multi='outgoing_mail_config', + selection=[('none', 'None'), + ('starttls', 'TLS (STARTTLS)'), + ('ssl', 'SSL/TLS')], + states={'draft': [('readonly', True)]}, + help="Choose the connection encryption scheme:\n" + "- none: SMTP sessions are done in cleartext.\n" + "- starttls: TLS encryption is requested at start " + "of SMTP session (Recommended)\n" + "- ssl: SMTP sessions are encrypted with SSL/TLS " + "through a dedicated port (default: 465)") + } + + +class FetchmailServer(orm.Model): """Incoming POP/IMAP mail server account""" _inherit = 'fetchmail.server' - def _get_incom_conf(self, cursor, uid, ids, name, args, context=None): + def _get_incom_conf(self, cr, uid, ids, name, args, context=None): """ Return configuration """ res = {} - for fetchmail in self.browse(cursor, uid, ids): + for fetchmail in self.browse(cr, uid, ids, context=context): global_section_name = 'incoming_mail' key_types = {'port': int, 'is_ssl': lambda a: bool(int(a)), 'attach': lambda a: bool(int(a)), - 'original': lambda a: bool(int(a)),} + 'original': lambda a: bool(int(a)), + } # default vals config_vals = {'port': 993, 'is_ssl': 0, 'attach': 0, - 'original': 0} + 'original': 0, + } if serv_config.has_section(global_section_name): config_vals.update(serv_config.items(global_section_name)) - custom_section_name = '.'.join((global_section_name, fetchmail.name)) + custom_section_name = '.'.join((global_section_name, + fetchmail.name)) if serv_config.has_section(custom_section_name): config_vals.update(serv_config.items(custom_section_name)) @@ -128,81 +140,93 @@ def _get_incom_conf(self, cursor, uid, ids, name, args, context=None): res[fetchmail.id] = config_vals return res - def _type_search(self, cr, uid, obj, name, args, context={}): + def _type_search(self, cr, uid, obj, name, args, context=None): result_ids = [] - # read all incomming servers values + # read all incoming servers values all_ids = self.search(cr, uid, [], context=context) - results = self.read(cr, uid, all_ids, ['id','type'], context=context) + results = self.read(cr, uid, all_ids, ['id', 'type'], context=context) args = args[:] i = 0 while i < len(args): operator = args[i][1] if operator == '=': for res in results: - if (res['type'] == args[i][2]) and (res['id'] not in result_ids): + if (res['type'] == args[i][2] and + res['id'] not in result_ids): result_ids.append(res['id']) elif operator == 'in': for search_vals in args[i][2]: for res in results: - if (res['type'] == search_vals) and (res['id'] not in result_ids): - result_ids.append(res['id']) + if (res['type'] == search_vals and + res['id'] not in result_ids): + result_ids.append(res['id']) else: continue i += 1 return [('id', 'in', result_ids)] _columns = { - 'server': fields.function(_get_incom_conf, - method=True, - string='Server', - type="char", - multi='income_mail_config', - size=256, help="Hostname or IP of the mail server"), - 'port': fields.function(_get_incom_conf, - method=True, - string='Port', - type="integer", - multi='income_mail_config', - help="Hostname or IP of the mail server"), - 'type': fields.function(_get_incom_conf, - method=True, - string='Type', - type="char", - multi='income_mail_config', - fnct_search=_type_search, - size=64, - help="pop, imap, local"), - 'is_ssl': fields.function(_get_incom_conf, - method=True, - string='Is SSL', - type="boolean", - multi='income_mail_config', - help='Connections are encrypted with SSL/TLS through' - ' a dedicated port (default: IMAPS=993, POP3S=995)'), - 'attach': fields.function(_get_incom_conf, - method=True, - string='Keep Attachments', - type="boolean", - multi='income_mail_config', - help="Whether attachments should be downloaded. " - "If not enabled, incoming emails will be stripped of any attachments before being processed"), - 'original': fields.function(_get_incom_conf, - method=True, - string='Keep Original', - type="boolean", - multi='income_mail_config', - help="Whether a full original copy of each email should be kept for reference" - "and attached to each processed message. This will usually double the size of your message database."), - 'user': fields.function(_get_incom_conf, - method=True, - string='Username', - type="char", - multi='income_mail_config', - size=64), - 'password': fields.function(_get_incom_conf, - method=True, - string='password', - type="char", - multi='income_mail_config', - size=64)} -FetchmailServer() + 'server': fields.function( + _get_incom_conf, + string='Server', + type="char", + multi='income_mail_config', + states={'draft': [('readonly', True)]}, + help="Hostname or IP of the mail server"), + 'port': fields.function( + _get_incom_conf, + string='Port', + type="integer", + states={'draft': [('readonly', True)]}, + multi='income_mail_config'), + 'type': fields.function( + _get_incom_conf, + string='Type', + type="selection", + selection=[('pop', 'POP Server'), + ('imap', 'IMAP Server'), + ('local', 'Local Server'), + ], + multi='income_mail_config', + fnct_search=_type_search, + states={'draft': [('readonly', True)]}, + help="pop, imap, local"), + 'is_ssl': fields.function( + _get_incom_conf, + string='Is SSL', + type="boolean", + multi='income_mail_config', + states={'draft': [('readonly', True)]}, + help='Connections are encrypted with SSL/TLS through' + ' a dedicated port (default: IMAPS=993, POP3S=995)'), + 'attach': fields.function( + _get_incom_conf, + string='Keep Attachments', + type="boolean", + multi='income_mail_config', + states={'draft': [('readonly', True)]}, + help="Whether attachments should be downloaded. " + "If not enabled, incoming emails will be stripped of any " + "attachments before being processed"), + 'original': fields.function( + _get_incom_conf, + string='Keep Original', + type="boolean", + multi='income_mail_config', + states={'draft': [('readonly', True)]}, + help="Whether a full original copy of each email should be kept " + "for reference and attached to each processed message. This " + "will usually double the size of your message database."), + 'user': fields.function( + _get_incom_conf, + string='Username', + type="char", + states={'draft': [('readonly', True)]}, + multi='income_mail_config'), + 'password': fields.function( + _get_incom_conf, + string='password', + type="char", + states={'draft': [('readonly', True)]}, + multi='income_mail_config') + } diff --git a/mail_environment/mail_view.xml b/mail_environment/mail_view.xml index 59577ed21..505b95278 100644 --- a/mail_environment/mail_view.xml +++ b/mail_environment/mail_view.xml @@ -1,27 +1,24 @@ - - - - inherit_fetchmail_for_env_support - fetchmail.server - - - - - - - - - - - - - - - - - - - + + + inherit_fetchmail_for_env_support + fetchmail.server + + + + + + + + + + + + + + + + + From dad7fb26dfb95fd81425b734818f02f6bed1a3b5 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Mar 2015 17:28:09 +0100 Subject: [PATCH 06/52] Add OCA as author of OCA addons In order to get visibility on https://www.odoo.com/apps the OCA board has decided to add the OCA as author of all the addons maintained as part of the association. --- mail_environment/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail_environment/__openerp__.py b/mail_environment/__openerp__.py index 05efe5717..04f6ae03e 100644 --- a/mail_environment/__openerp__.py +++ b/mail_environment/__openerp__.py @@ -56,7 +56,7 @@ """, - 'author': 'Camptocamp', + 'author': "Camptocamp,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'website': 'http://openerp.camptocamp.com', 'depends': ['mail', From db7bdab6089a40a4e7a429d357e63a2a0bc2a839 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Fri, 17 Jul 2015 15:32:06 +0200 Subject: [PATCH 07/52] fix runbot warning rename *_xml entries in manifest --- mail_environment/__openerp__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mail_environment/__openerp__.py b/mail_environment/__openerp__.py index 04f6ae03e..e1042265c 100644 --- a/mail_environment/__openerp__.py +++ b/mail_environment/__openerp__.py @@ -64,9 +64,8 @@ 'server_environment', 'server_environment_files', ], - 'init_xml': [], - 'update_xml': ['mail_view.xml'], - 'demo_xml': [], + 'data': ['mail_view.xml'], + 'demo': [], 'installable': True, 'active': False, } From bc79e2222bb8add0da3adf6b3dd4fb98c7ba9a4d Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Tue, 18 Aug 2015 10:47:52 +0200 Subject: [PATCH 08/52] Add missing default oca icons --- mail_environment/static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 mail_environment/static/description/icon.png diff --git a/mail_environment/static/description/icon.png b/mail_environment/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{I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--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 From 5524f4095ad7bc0494d449988b5159064404ceb6 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 18 Aug 2015 14:33:02 +0200 Subject: [PATCH 09/52] [FIX] like #230, but for mail_environment --- mail_environment/static/description/icon.png | Bin 9455 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 mail_environment/static/description/icon.png diff --git a/mail_environment/static/description/icon.png b/mail_environment/static/description/icon.png deleted file mode 100644 index 3a0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 2015 10:03:09 +0200 Subject: [PATCH 10/52] [UPD] prefix versions with 8.0 --- mail_environment/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail_environment/__openerp__.py b/mail_environment/__openerp__.py index e1042265c..cb5dca0e6 100644 --- a/mail_environment/__openerp__.py +++ b/mail_environment/__openerp__.py @@ -21,7 +21,7 @@ { 'name': 'Server env config for mail + fetchmail', - 'version': '0.1', + 'version': '8.0.0.1.0', 'category': 'Tools', 'description': """ Extend mail and fetch mail with server environment module. From 3af174406695e0a6dac1c24f92a56aad1f4de173 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 14 Oct 2015 02:53:59 +0200 Subject: [PATCH 11/52] [MIG] Make modules uninstallable --- mail_environment/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail_environment/__openerp__.py b/mail_environment/__openerp__.py index cb5dca0e6..f51cb97fd 100644 --- a/mail_environment/__openerp__.py +++ b/mail_environment/__openerp__.py @@ -66,6 +66,6 @@ ], 'data': ['mail_view.xml'], 'demo': [], - 'installable': True, + 'installable': False, 'active': False, } From eb85dcd16398fb22e3c8e2078b5e7d41d45340ce Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Wed, 20 Jan 2016 19:06:14 +0100 Subject: [PATCH 12/52] 9.0 migration of mail_environment --- mail_environment/README.rst | 121 ++++++++++++++++++++++++++++++++ mail_environment/__openerp__.py | 49 ++----------- 2 files changed, 127 insertions(+), 43 deletions(-) create mode 100644 mail_environment/README.rst diff --git a/mail_environment/README.rst b/mail_environment/README.rst new file mode 100644 index 000000000..388ec9ac2 --- /dev/null +++ b/mail_environment/README.rst @@ -0,0 +1,121 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +========================================== +Mail configuration with server_environment +========================================== + +This module allows to configure the incoming and outgoing mail servers +using the `server_environment` mechanism: you can then have different +mail servers for the production and the test environment. + +Installation +============ + +To install this module, you need to have the server_environment module +installed and properly configured. + +Configuration +============= + +With this module installed, the incoming and outgoing mail servers are +configured in the `server_environment_files` module (which is a module +you should provide, see the documentation of `server_environment` for +more information). + +In the configuration file of each environment, you may first use the +sections `[outgoing_mail]` and `[incoming_mail]` to configure the +default values respectively for SMTP servers and the IMAP/POP servers. + +Then for each server, you can define additional values or override the +default values with a section named `[outgoing_mail.resource_name]` or +`[incoming_mail.resource_name]` where "resource_name" is the name of +the server. + +Exemple of config file : + +[outgoing_mail] +smtp_host = smtp.myserver.com +smtp_port = 587 +smtp_user = +smtp_pass = +smtp_encryption = ssl + +[outgoing_mail.odoo_smtp_server1] +smtp_user = odoo +smtp_pass = odoo + +[incoming_mail.odoo_pop_mail1] +server = mail.myserver.com +port = 110 +type = pop +is_ssl = 0 +attach = 0 +original = 0 +user = odoo@myserver.com +password = uas1ohV0 + +You will need to create 2 records in the database, one outgoing mail +server with the field `name` set to "odoo_smtp_server1" and one +incoming mail server with the field `name` set to "odoo_pop_mail1". + + +Usage +===== + +Once configured, Odoo will read the mail servers values from the +configuration file related to each environment defined in the main +Odoo file. + + +Known issues / Roadmap +====================== + +* Due to the special nature of this addon, you cannot test it on the OCA +runbot. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed `feedback +`_. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Nicolas Bessi +* Yannick Vaucher +* Guewen Baconnier +* Joël Grand-Guillaume +* Holger Brunn +* Alexandre Fayolle + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/mail_environment/__openerp__.py b/mail_environment/__openerp__.py index f51cb97fd..f71e4bf73 100644 --- a/mail_environment/__openerp__.py +++ b/mail_environment/__openerp__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -############################################################################## # # Author: Nicolas Bessi # Copyright 2012 Camptocamp SA @@ -16,56 +15,20 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -# -############################################################################## { - 'name': 'Server env config for mail + fetchmail', - 'version': '8.0.0.1.0', + 'name': 'Mail configuration with server_environment', + 'version': '9.0.1.0.0', 'category': 'Tools', - 'description': """ -Extend mail and fetch mail with server environment module. - -In config files, sections outgoing_mail and incoming_mails are default values -for all Outgoing Mail Servers and Fetchmail Servers. -For each server, you can (re)define values with a section named -"outgoing_mail.resource_name" where resource_name is the name of your server. - -Exemple of config file : - -[outgoing_mail] -smtp_host = smtp.myserver.com -smtp_port = 587 -smtp_user = -smtp_pass = -smtp_encryption = ssl - -[outgoing_mail.openerp_smtp_server1] -smtp_user = openerp -smtp_pass = openerp - -[incoming_mail.openerp_pop_mail1] -server = mail.myserver.com -port = 110 -type = pop -is_ssl = 0 -attach = 0 -original = 0 -user = openerp@myserver.com -password = openerp - - - """, + 'summary': 'Configure mail servers with server_environment_files', 'author': "Camptocamp,Odoo Community Association (OCA)", 'license': 'AGPL-3', - 'website': 'http://openerp.camptocamp.com', - 'depends': ['mail', - 'fetchmail', + 'website': 'http://odoo-community.org', + 'depends': ['fetchmail', 'server_environment', 'server_environment_files', ], 'data': ['mail_view.xml'], - 'demo': [], - 'installable': False, + 'installable': True, 'active': False, } From a9ca54c92950c6740b5424ce18c8cc390797676d Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 6 Oct 2016 16:08:19 +0200 Subject: [PATCH 13/52] [MIG] pre migration changes [MIG] Rename manifest files --- mail_environment/{__openerp__.py => __manifest__.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename mail_environment/{__openerp__.py => __manifest__.py} (97%) diff --git a/mail_environment/__openerp__.py b/mail_environment/__manifest__.py similarity index 97% rename from mail_environment/__openerp__.py rename to mail_environment/__manifest__.py index f71e4bf73..6026bf771 100644 --- a/mail_environment/__openerp__.py +++ b/mail_environment/__manifest__.py @@ -29,6 +29,6 @@ 'server_environment_files', ], 'data': ['mail_view.xml'], - 'installable': True, + 'installable': False, 'active': False, } From 7474be3394095f40240f178cc50aa1820b9bf9af Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Wed, 21 Dec 2016 12:45:46 +0100 Subject: [PATCH 14/52] Migrate mail_environment to 10.0 --- mail_environment/README.rst | 6 +- mail_environment/__init__.py | 2 +- mail_environment/__manifest__.py | 26 +- mail_environment/env_mail.py | 232 ------------------ mail_environment/mail_view.xml | 24 -- mail_environment/models/__init__.py | 3 + mail_environment/models/fetchmail_server.py | 74 ++++++ mail_environment/models/ir_mail_server.py | 46 ++++ .../views/fetchmail_server_views.xml | 21 ++ 9 files changed, 152 insertions(+), 282 deletions(-) delete mode 100644 mail_environment/env_mail.py delete mode 100644 mail_environment/mail_view.xml create mode 100644 mail_environment/models/__init__.py create mode 100644 mail_environment/models/fetchmail_server.py create mode 100644 mail_environment/models/ir_mail_server.py create mode 100644 mail_environment/views/fetchmail_server_views.xml diff --git a/mail_environment/README.rst b/mail_environment/README.rst index 388ec9ac2..fd0643a28 100644 --- a/mail_environment/README.rst +++ b/mail_environment/README.rst @@ -81,11 +81,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed `feedback -`_. +help us smashing it by providing a detailed and welcomed feedback. Credits ======= diff --git a/mail_environment/__init__.py b/mail_environment/__init__.py index 89dd1478f..a0fdc10fe 100644 --- a/mail_environment/__init__.py +++ b/mail_environment/__init__.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -from . import env_mail +from . import models diff --git a/mail_environment/__manifest__.py b/mail_environment/__manifest__.py index 6026bf771..ca9d8e063 100644 --- a/mail_environment/__manifest__.py +++ b/mail_environment/__manifest__.py @@ -1,24 +1,10 @@ # -*- coding: utf-8 -*- -# -# Author: Nicolas Bessi -# Copyright 2012 Camptocamp SA -# -# 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 . +# Copyright 2012-2016 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) { 'name': 'Mail configuration with server_environment', - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'category': 'Tools', 'summary': 'Configure mail servers with server_environment_files', 'author': "Camptocamp,Odoo Community Association (OCA)", @@ -28,7 +14,7 @@ 'server_environment', 'server_environment_files', ], - 'data': ['mail_view.xml'], - 'installable': False, - 'active': False, + 'data': ['views/fetchmail_server_views.xml', + ], + 'installable': True, } diff --git a/mail_environment/env_mail.py b/mail_environment/env_mail.py deleted file mode 100644 index c4025340a..000000000 --- a/mail_environment/env_mail.py +++ /dev/null @@ -1,232 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi -# Copyright 2012 Camptocamp SA -# -# 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 . -# -############################################################################## - -from openerp.osv import orm, fields - -from openerp.addons.server_environment import serv_config - - -class IrMail(orm.Model): - _inherit = "ir.mail_server" - - def _get_smtp_conf(self, cr, uid, ids, name, args, context=None): - """ - Return configuration - """ - res = {} - for mail_server in self.browse(cr, uid, ids, context=context): - global_section_name = 'outgoing_mail' - - # default vals - config_vals = {'smtp_port': 587} - if serv_config.has_section(global_section_name): - config_vals.update((serv_config.items(global_section_name))) - - custom_section_name = '.'.join((global_section_name, - mail_server.name)) - if serv_config.has_section(custom_section_name): - config_vals.update(serv_config.items(custom_section_name)) - - if config_vals.get('smtp_port'): - config_vals['smtp_port'] = int(config_vals['smtp_port']) - - res[mail_server.id] = config_vals - return res - - _columns = { - 'smtp_host': fields.function( - _get_smtp_conf, - string='SMTP Server', - type="char", - multi='outgoing_mail_config', - states={'draft': [('readonly', True)]}, - help="Hostname or IP of SMTP server"), - 'smtp_port': fields.function( - _get_smtp_conf, - string='SMTP Port', - type="integer", - multi='outgoing_mail_config', - states={'draft': [('readonly', True)]}, - help="SMTP Port. Usually 465 for SSL, " - "and 25 or 587 for other cases.", - size=5), - 'smtp_user': fields.function( - _get_smtp_conf, - string='Username', - type="char", - multi='outgoing_mail_config', - states={'draft': [('readonly', True)]}, - help="Optional username for SMTP authentication", - size=64), - 'smtp_pass': fields.function( - _get_smtp_conf, - string='Password', - type="char", - multi='outgoing_mail_config', - states={'draft': [('readonly', True)]}, - help="Optional password for SMTP authentication", - size=64), - 'smtp_encryption': fields.function( - _get_smtp_conf, - string='smtp_encryption', - type="selection", - multi='outgoing_mail_config', - selection=[('none', 'None'), - ('starttls', 'TLS (STARTTLS)'), - ('ssl', 'SSL/TLS')], - states={'draft': [('readonly', True)]}, - help="Choose the connection encryption scheme:\n" - "- none: SMTP sessions are done in cleartext.\n" - "- starttls: TLS encryption is requested at start " - "of SMTP session (Recommended)\n" - "- ssl: SMTP sessions are encrypted with SSL/TLS " - "through a dedicated port (default: 465)") - } - - -class FetchmailServer(orm.Model): - """Incoming POP/IMAP mail server account""" - _inherit = 'fetchmail.server' - - def _get_incom_conf(self, cr, uid, ids, name, args, context=None): - """ - Return configuration - """ - res = {} - for fetchmail in self.browse(cr, uid, ids, context=context): - global_section_name = 'incoming_mail' - - key_types = {'port': int, - 'is_ssl': lambda a: bool(int(a)), - 'attach': lambda a: bool(int(a)), - 'original': lambda a: bool(int(a)), - } - - # default vals - config_vals = {'port': 993, - 'is_ssl': 0, - 'attach': 0, - 'original': 0, - } - if serv_config.has_section(global_section_name): - config_vals.update(serv_config.items(global_section_name)) - - custom_section_name = '.'.join((global_section_name, - fetchmail.name)) - if serv_config.has_section(custom_section_name): - config_vals.update(serv_config.items(custom_section_name)) - - for key, to_type in key_types.iteritems(): - if config_vals.get(key): - config_vals[key] = to_type(config_vals[key]) - res[fetchmail.id] = config_vals - return res - - def _type_search(self, cr, uid, obj, name, args, context=None): - result_ids = [] - # read all incoming servers values - all_ids = self.search(cr, uid, [], context=context) - results = self.read(cr, uid, all_ids, ['id', 'type'], context=context) - args = args[:] - i = 0 - while i < len(args): - operator = args[i][1] - if operator == '=': - for res in results: - if (res['type'] == args[i][2] and - res['id'] not in result_ids): - result_ids.append(res['id']) - elif operator == 'in': - for search_vals in args[i][2]: - for res in results: - if (res['type'] == search_vals and - res['id'] not in result_ids): - result_ids.append(res['id']) - else: - continue - i += 1 - return [('id', 'in', result_ids)] - - _columns = { - 'server': fields.function( - _get_incom_conf, - string='Server', - type="char", - multi='income_mail_config', - states={'draft': [('readonly', True)]}, - help="Hostname or IP of the mail server"), - 'port': fields.function( - _get_incom_conf, - string='Port', - type="integer", - states={'draft': [('readonly', True)]}, - multi='income_mail_config'), - 'type': fields.function( - _get_incom_conf, - string='Type', - type="selection", - selection=[('pop', 'POP Server'), - ('imap', 'IMAP Server'), - ('local', 'Local Server'), - ], - multi='income_mail_config', - fnct_search=_type_search, - states={'draft': [('readonly', True)]}, - help="pop, imap, local"), - 'is_ssl': fields.function( - _get_incom_conf, - string='Is SSL', - type="boolean", - multi='income_mail_config', - states={'draft': [('readonly', True)]}, - help='Connections are encrypted with SSL/TLS through' - ' a dedicated port (default: IMAPS=993, POP3S=995)'), - 'attach': fields.function( - _get_incom_conf, - string='Keep Attachments', - type="boolean", - multi='income_mail_config', - states={'draft': [('readonly', True)]}, - help="Whether attachments should be downloaded. " - "If not enabled, incoming emails will be stripped of any " - "attachments before being processed"), - 'original': fields.function( - _get_incom_conf, - string='Keep Original', - type="boolean", - multi='income_mail_config', - states={'draft': [('readonly', True)]}, - help="Whether a full original copy of each email should be kept " - "for reference and attached to each processed message. This " - "will usually double the size of your message database."), - 'user': fields.function( - _get_incom_conf, - string='Username', - type="char", - states={'draft': [('readonly', True)]}, - multi='income_mail_config'), - 'password': fields.function( - _get_incom_conf, - string='password', - type="char", - states={'draft': [('readonly', True)]}, - multi='income_mail_config') - } diff --git a/mail_environment/mail_view.xml b/mail_environment/mail_view.xml deleted file mode 100644 index 505b95278..000000000 --- a/mail_environment/mail_view.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - inherit_fetchmail_for_env_support - fetchmail.server - - - - - - - - - - - - - - - - - - diff --git a/mail_environment/models/__init__.py b/mail_environment/models/__init__.py new file mode 100644 index 000000000..493195a0d --- /dev/null +++ b/mail_environment/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +from . import ir_mail_server +from . import fetchmail_server diff --git a/mail_environment/models/fetchmail_server.py b/mail_environment/models/fetchmail_server.py new file mode 100644 index 000000000..6d94def76 --- /dev/null +++ b/mail_environment/models/fetchmail_server.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +# Copyright 2012-2016 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +import operator +from odoo import api, fields, models + +from odoo.addons.server_environment import serv_config + + +class FetchmailServer(models.Model): + """Incoming POP/IMAP mail server account""" + _inherit = 'fetchmail.server' + + server = fields.Char(compute='_compute_server_env', + states={}) + port = fields.Integer(compute='_compute_server_env', + states={}) + type = fields.Selection(compute='_compute_server_env', + search='_search_type', + states={}) + user = fields.Char(compute='_compute_server_env', + states={}) + password = fields.Char(compute='_compute_server_env', + states={}) + is_ssl = fields.Boolean(compute='_compute_server_env') + attach = fields.Boolean(compute='_compute_server_env') + original = fields.Boolean(compute='_compute_server_env') + + @api.depends() + def _compute_server_env(self): + for fetchmail in self: + global_section_name = 'incoming_mail' + + key_types = {'port': int, + 'is_ssl': lambda a: bool(int(a or 0)), + 'attach': lambda a: bool(int(a or 0)), + 'original': lambda a: bool(int(a or 0)), + } + + # default vals + config_vals = {'port': 993, + 'is_ssl': 0, + 'attach': 0, + 'original': 0, + } + if serv_config.has_section(global_section_name): + config_vals.update(serv_config.items(global_section_name)) + + custom_section_name = '.'.join((global_section_name, + fetchmail.name)) + if serv_config.has_section(custom_section_name): + config_vals.update(serv_config.items(custom_section_name)) + + for key, to_type in key_types.iteritems(): + if config_vals.get(key): + config_vals[key] = to_type(config_vals[key]) + + fetchmail.update(config_vals) + + @api.model + def _search_type(self, oper, value): + operators = { + '=': operator.eq, + '!=': operator.ne, + 'in': operator.contains, + 'not in': lambda a, b: not operator.contains(a, b), + } + if oper not in operators: + return [('id', 'in', [])] + servers = self.search([]).filtered( + lambda s: operators[oper](value, s.type) + ) + return [('id', 'in', servers.ids)] diff --git a/mail_environment/models/ir_mail_server.py b/mail_environment/models/ir_mail_server.py new file mode 100644 index 000000000..4aaed6257 --- /dev/null +++ b/mail_environment/models/ir_mail_server.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2012-2016 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import api, fields, models + +from odoo.addons.server_environment import serv_config + + +class IrMailServer(models.Model): + _inherit = "ir.mail_server" + + smtp_host = fields.Char(compute='_compute_server_env', + required=False, + readonly=True) + smtp_port = fields.Integer(compute='_compute_server_env', + required=False, + readonly=True) + smtp_user = fields.Char(compute='_compute_server_env', + required=False, + readonly=True) + smtp_pass = fields.Char(compute='_compute_server_env', + required=False, + readonly=True) + smtp_encryption = fields.Selection(compute='_compute_server_env', + required=False, + readonly=True) + + @api.depends() + def _compute_server_env(self): + for server in self: + global_section_name = 'outgoing_mail' + + # default vals + config_vals = {'smtp_port': 587} + if serv_config.has_section(global_section_name): + config_vals.update((serv_config.items(global_section_name))) + + custom_section_name = '.'.join((global_section_name, server.name)) + if serv_config.has_section(custom_section_name): + config_vals.update(serv_config.items(custom_section_name)) + + if config_vals.get('smtp_port'): + config_vals['smtp_port'] = int(config_vals['smtp_port']) + + server.update(config_vals) diff --git a/mail_environment/views/fetchmail_server_views.xml b/mail_environment/views/fetchmail_server_views.xml new file mode 100644 index 000000000..1b04550b4 --- /dev/null +++ b/mail_environment/views/fetchmail_server_views.xml @@ -0,0 +1,21 @@ + + + + fetchmail.server + + + + + + + + + + + + + + + + + From 10d6b27cd5bdf046ed31b2e42fd1fcb01396215e Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 24 Mar 2017 15:27:55 +0100 Subject: [PATCH 15/52] README.rst - Fix layout --- mail_environment/README.rst | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/mail_environment/README.rst b/mail_environment/README.rst index fd0643a28..9dbfb62e0 100644 --- a/mail_environment/README.rst +++ b/mail_environment/README.rst @@ -33,28 +33,28 @@ default values with a section named `[outgoing_mail.resource_name]` or `[incoming_mail.resource_name]` where "resource_name" is the name of the server. -Exemple of config file : - -[outgoing_mail] -smtp_host = smtp.myserver.com -smtp_port = 587 -smtp_user = -smtp_pass = -smtp_encryption = ssl - -[outgoing_mail.odoo_smtp_server1] -smtp_user = odoo -smtp_pass = odoo - -[incoming_mail.odoo_pop_mail1] -server = mail.myserver.com -port = 110 -type = pop -is_ssl = 0 -attach = 0 -original = 0 -user = odoo@myserver.com -password = uas1ohV0 +Exemple of config file :: + + [outgoing_mail] + smtp_host = smtp.myserver.com + smtp_port = 587 + smtp_user = + smtp_pass = + smtp_encryption = ssl + + [outgoing_mail.odoo_smtp_server1] + smtp_user = odoo + smtp_pass = odoo + + [incoming_mail.odoo_pop_mail1] + server = mail.myserver.com + port = 110 + type = pop + is_ssl = 0 + attach = 0 + original = 0 + user = odoo@myserver.com + password = uas1ohV0 You will need to create 2 records in the database, one outgoing mail server with the field `name` set to "odoo_smtp_server1" and one @@ -73,7 +73,7 @@ Known issues / Roadmap ====================== * Due to the special nature of this addon, you cannot test it on the OCA -runbot. + runbot. Bug Tracker =========== From d8df9cc5f7bb780129aa55f995f3207d53c6b34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Sun, 23 Apr 2017 21:24:45 +0200 Subject: [PATCH 16/52] [FIX] mail_environment must not depend on server_environment_files Depending on server_environment is enough --- mail_environment/__manifest__.py | 1 - mail_environment/i18n/de.po | 29 +++++++++++++++++++++++++++++ mail_environment/i18n/en.po | 28 ++++++++++++++++++++++++++++ mail_environment/i18n/es.po | 29 +++++++++++++++++++++++++++++ mail_environment/i18n/hr.po | 29 +++++++++++++++++++++++++++++ mail_environment/i18n/pt_BR.po | 23 +++++++++++++++++++++++ mail_environment/i18n/sl.po | 29 +++++++++++++++++++++++++++++ mail_environment/i18n/zh_CN.po | 29 +++++++++++++++++++++++++++++ 8 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 mail_environment/i18n/de.po create mode 100644 mail_environment/i18n/en.po create mode 100644 mail_environment/i18n/es.po create mode 100644 mail_environment/i18n/hr.po create mode 100644 mail_environment/i18n/pt_BR.po create mode 100644 mail_environment/i18n/sl.po create mode 100644 mail_environment/i18n/zh_CN.po diff --git a/mail_environment/__manifest__.py b/mail_environment/__manifest__.py index ca9d8e063..5ae2b6512 100644 --- a/mail_environment/__manifest__.py +++ b/mail_environment/__manifest__.py @@ -12,7 +12,6 @@ 'website': 'http://odoo-community.org', 'depends': ['fetchmail', 'server_environment', - 'server_environment_files', ], 'data': ['views/fetchmail_server_views.xml', ], diff --git a/mail_environment/i18n/de.po b/mail_environment/i18n/de.po new file mode 100644 index 000000000..0be52af5f --- /dev/null +++ b/mail_environment/i18n/de.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_environment +# +# Translators: +# Rudolf Schnapka , 2016 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-17 12:15+0000\n" +"PO-Revision-Date: 2016-04-21 09:16+0000\n" +"Last-Translator: Rudolf Schnapka \n" +"Language-Team: German (http://www.transifex.com/oca/OCA-server-tools-9-0/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "POP/IMAP Server" +msgstr "POP/IMAP-Server" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_ir_mail_server +msgid "ir.mail_server" +msgstr "ir.mail_server" diff --git a/mail_environment/i18n/en.po b/mail_environment/i18n/en.po new file mode 100644 index 000000000..f08797182 --- /dev/null +++ b/mail_environment/i18n/en.po @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_environment +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: server-tools (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-27 01:37+0000\n" +"PO-Revision-Date: 2016-02-26 16:14+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: English (http://www.transifex.com/oca/OCA-server-tools-9-0/language/en/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "POP/IMAP Server" +msgstr "POP/IMAP Server" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_ir_mail_server +msgid "ir.mail_server" +msgstr "ir.mail_server" diff --git a/mail_environment/i18n/es.po b/mail_environment/i18n/es.po new file mode 100644 index 000000000..d8565002e --- /dev/null +++ b/mail_environment/i18n/es.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_environment +# +# Translators: +# Pedro M. Baeza , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-01 10:38+0000\n" +"PO-Revision-Date: 2017-05-01 10:38+0000\n" +"Last-Translator: Pedro M. Baeza , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "POP/IMAP Server" +msgstr "" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_ir_mail_server +msgid "ir.mail_server" +msgstr "ir.mail_server" diff --git a/mail_environment/i18n/hr.po b/mail_environment/i18n/hr.po new file mode 100644 index 000000000..bfa25bc99 --- /dev/null +++ b/mail_environment/i18n/hr.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_environment +# +# Translators: +# Bole , 2016 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-29 00:48+0000\n" +"PO-Revision-Date: 2016-06-14 10:58+0000\n" +"Last-Translator: Bole \n" +"Language-Team: Croatian (http://www.transifex.com/oca/OCA-server-tools-9-0/language/hr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: hr\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "POP/IMAP Server" +msgstr "POP/IMAP Server" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_ir_mail_server +msgid "ir.mail_server" +msgstr "ir.mail_server" diff --git a/mail_environment/i18n/pt_BR.po b/mail_environment/i18n/pt_BR.po new file mode 100644 index 000000000..f929bd3d5 --- /dev/null +++ b/mail_environment/i18n/pt_BR.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_environment +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: server-tools (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-29 11:14+0000\n" +"PO-Revision-Date: 2015-09-18 13:55+0000\n" +"Last-Translator: <>\n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-server-tools-8-0/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "POP/IMAP Server" +msgstr "Servidor POP/IMAP" diff --git a/mail_environment/i18n/sl.po b/mail_environment/i18n/sl.po new file mode 100644 index 000000000..03f146fe1 --- /dev/null +++ b/mail_environment/i18n/sl.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_environment +# +# Translators: +# Matjaž Mozetič , 2016 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-27 01:37+0000\n" +"PO-Revision-Date: 2016-02-27 16:56+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-server-tools-9-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "POP/IMAP Server" +msgstr "POP/IMAP strežnik" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_ir_mail_server +msgid "ir.mail_server" +msgstr "ir.mail_server" diff --git a/mail_environment/i18n/zh_CN.po b/mail_environment/i18n/zh_CN.po new file mode 100644 index 000000000..6836584c0 --- /dev/null +++ b/mail_environment/i18n/zh_CN.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_environment +# +# Translators: +# Jeffery Chenn , 2016 +msgid "" +msgstr "" +"Project-Id-Version: server-tools (9.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-08-31 11:58+0000\n" +"PO-Revision-Date: 2016-09-04 06:08+0000\n" +"Last-Translator: Jeffery Chenn \n" +"Language-Team: Chinese (China) (http://www.transifex.com/oca/OCA-server-tools-9-0/language/zh_CN/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: zh_CN\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "POP/IMAP Server" +msgstr "POP/IMAP 服务器" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_ir_mail_server +msgid "ir.mail_server" +msgstr "" From 08dd99485c115b480bb8cf090bd2f6a5bbb1555b Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Wed, 29 Nov 2017 16:51:05 +0100 Subject: [PATCH 17/52] [11.0][MIG] mail_environment --- mail_environment/README.rst | 4 ++-- mail_environment/__init__.py | 1 - mail_environment/__manifest__.py | 22 +++++++++---------- mail_environment/models/__init__.py | 1 - mail_environment/models/fetchmail_server.py | 6 ++--- mail_environment/models/ir_mail_server.py | 4 +--- .../views/fetchmail_server_views.xml | 4 +++- 7 files changed, 19 insertions(+), 23 deletions(-) diff --git a/mail_environment/README.rst b/mail_environment/README.rst index 9dbfb62e0..4093b45df 100644 --- a/mail_environment/README.rst +++ b/mail_environment/README.rst @@ -33,7 +33,7 @@ default values with a section named `[outgoing_mail.resource_name]` or `[incoming_mail.resource_name]` where "resource_name" is the name of the server. -Exemple of config file :: +Example of config file :: [outgoing_mail] smtp_host = smtp.myserver.com @@ -81,7 +81,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +help us smash it by providing a detailed and welcomed feedback. Credits ======= diff --git a/mail_environment/__init__.py b/mail_environment/__init__.py index a0fdc10fe..0650744f6 100644 --- a/mail_environment/__init__.py +++ b/mail_environment/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- from . import models diff --git a/mail_environment/__manifest__.py b/mail_environment/__manifest__.py index 5ae2b6512..00983c108 100644 --- a/mail_environment/__manifest__.py +++ b/mail_environment/__manifest__.py @@ -1,19 +1,19 @@ -# -*- coding: utf-8 -*- -# Copyright 2012-2016 Camptocamp SA +# Copyright 2012-2018 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) { 'name': 'Mail configuration with server_environment', - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'category': 'Tools', 'summary': 'Configure mail servers with server_environment_files', - 'author': "Camptocamp,Odoo Community Association (OCA)", + 'author': "Camptocamp, Odoo Community Association (OCA)", 'license': 'AGPL-3', - 'website': 'http://odoo-community.org', - 'depends': ['fetchmail', - 'server_environment', - ], - 'data': ['views/fetchmail_server_views.xml', - ], - 'installable': True, + 'website': 'https://github.com/OCA/server-env', + 'depends': [ + 'fetchmail', + 'server_environment', + ], + 'data': [ + 'views/fetchmail_server_views.xml', + ], } diff --git a/mail_environment/models/__init__.py b/mail_environment/models/__init__.py index 493195a0d..a21a540e3 100644 --- a/mail_environment/models/__init__.py +++ b/mail_environment/models/__init__.py @@ -1,3 +1,2 @@ -# -*- coding: utf-8 -*- from . import ir_mail_server from . import fetchmail_server diff --git a/mail_environment/models/fetchmail_server.py b/mail_environment/models/fetchmail_server.py index 6d94def76..72cd92613 100644 --- a/mail_environment/models/fetchmail_server.py +++ b/mail_environment/models/fetchmail_server.py @@ -1,10 +1,8 @@ -# -*- coding: utf-8 -*- -# Copyright 2012-2016 Camptocamp SA +# Copyright 2012-2018 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) import operator from odoo import api, fields, models - from odoo.addons.server_environment import serv_config @@ -52,7 +50,7 @@ def _compute_server_env(self): if serv_config.has_section(custom_section_name): config_vals.update(serv_config.items(custom_section_name)) - for key, to_type in key_types.iteritems(): + for key, to_type in key_types.items(): if config_vals.get(key): config_vals[key] = to_type(config_vals[key]) diff --git a/mail_environment/models/ir_mail_server.py b/mail_environment/models/ir_mail_server.py index 4aaed6257..1f45fd36d 100644 --- a/mail_environment/models/ir_mail_server.py +++ b/mail_environment/models/ir_mail_server.py @@ -1,9 +1,7 @@ -# -*- coding: utf-8 -*- -# Copyright 2012-2016 Camptocamp SA +# Copyright 2012-2018 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) from odoo import api, fields, models - from odoo.addons.server_environment import serv_config diff --git a/mail_environment/views/fetchmail_server_views.xml b/mail_environment/views/fetchmail_server_views.xml index 1b04550b4..0c7f1134e 100644 --- a/mail_environment/views/fetchmail_server_views.xml +++ b/mail_environment/views/fetchmail_server_views.xml @@ -1,6 +1,7 @@ - + + fetchmail.server @@ -18,4 +19,5 @@ + From d5f2a5ad13fc87824e1fbd48e1d0532acc17323c Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Thu, 19 Jul 2018 22:36:30 +0200 Subject: [PATCH 18/52] Use new server.env.mixin in mail_environment --- mail_environment/__manifest__.py | 6 +- mail_environment/models/fetchmail_server.py | 78 ++++++++----------- mail_environment/models/ir_mail_server.py | 64 +++++++-------- .../views/fetchmail_server_views.xml | 23 ------ 4 files changed, 61 insertions(+), 110 deletions(-) delete mode 100644 mail_environment/views/fetchmail_server_views.xml diff --git a/mail_environment/__manifest__.py b/mail_environment/__manifest__.py index 00983c108..46a4b8265 100644 --- a/mail_environment/__manifest__.py +++ b/mail_environment/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Mail configuration with server_environment', - 'version': '11.0.1.0.0', + 'version': '11.0.1.1.0', 'category': 'Tools', 'summary': 'Configure mail servers with server_environment_files', 'author': "Camptocamp, Odoo Community Association (OCA)", @@ -13,7 +13,5 @@ 'fetchmail', 'server_environment', ], - 'data': [ - 'views/fetchmail_server_views.xml', - ], + 'data': [], } diff --git a/mail_environment/models/fetchmail_server.py b/mail_environment/models/fetchmail_server.py index 72cd92613..ed3331243 100644 --- a/mail_environment/models/fetchmail_server.py +++ b/mail_environment/models/fetchmail_server.py @@ -3,58 +3,46 @@ import operator from odoo import api, fields, models -from odoo.addons.server_environment import serv_config class FetchmailServer(models.Model): """Incoming POP/IMAP mail server account""" - _inherit = 'fetchmail.server' - - server = fields.Char(compute='_compute_server_env', - states={}) - port = fields.Integer(compute='_compute_server_env', - states={}) - type = fields.Selection(compute='_compute_server_env', - search='_search_type', - states={}) - user = fields.Char(compute='_compute_server_env', - states={}) - password = fields.Char(compute='_compute_server_env', - states={}) - is_ssl = fields.Boolean(compute='_compute_server_env') - attach = fields.Boolean(compute='_compute_server_env') - original = fields.Boolean(compute='_compute_server_env') - - @api.depends() - def _compute_server_env(self): - for fetchmail in self: - global_section_name = 'incoming_mail' - - key_types = {'port': int, - 'is_ssl': lambda a: bool(int(a or 0)), - 'attach': lambda a: bool(int(a or 0)), - 'original': lambda a: bool(int(a or 0)), - } - - # default vals - config_vals = {'port': 993, - 'is_ssl': 0, - 'attach': 0, - 'original': 0, - } - if serv_config.has_section(global_section_name): - config_vals.update(serv_config.items(global_section_name)) + _name = 'fetchmail.server' + _inherit = ["fetchmail.server", "server.env.mixin"] + + @property + def _server_env_fields(self): + base_fields = super()._server_env_fields + mail_fields = { + "server": {}, + "port": { + "getter": "getint", + }, + "type": {}, + "user": {}, + "password": {}, + "is_ssl": { + "getter": "getbool", + }, + "attach": { + "getter": "getbool", + }, + "original": { + "getter": "getbool", + }, + } + mail_fields.update(base_fields) + return mail_fields - custom_section_name = '.'.join((global_section_name, - fetchmail.name)) - if serv_config.has_section(custom_section_name): - config_vals.update(serv_config.items(custom_section_name)) + type = fields.Selection(search='_search_type') - for key, to_type in key_types.items(): - if config_vals.get(key): - config_vals[key] = to_type(config_vals[key]) + @api.model + def _server_env_global_section_name(self): + """Name of the global section in the configuration files - fetchmail.update(config_vals) + Can be customized in your model + """ + return 'incoming_mail' @api.model def _search_type(self, oper, value): diff --git a/mail_environment/models/ir_mail_server.py b/mail_environment/models/ir_mail_server.py index 1f45fd36d..b1d53ceeb 100644 --- a/mail_environment/models/ir_mail_server.py +++ b/mail_environment/models/ir_mail_server.py @@ -1,44 +1,32 @@ # Copyright 2012-2018 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -from odoo import api, fields, models -from odoo.addons.server_environment import serv_config +from odoo import api, models class IrMailServer(models.Model): - _inherit = "ir.mail_server" - - smtp_host = fields.Char(compute='_compute_server_env', - required=False, - readonly=True) - smtp_port = fields.Integer(compute='_compute_server_env', - required=False, - readonly=True) - smtp_user = fields.Char(compute='_compute_server_env', - required=False, - readonly=True) - smtp_pass = fields.Char(compute='_compute_server_env', - required=False, - readonly=True) - smtp_encryption = fields.Selection(compute='_compute_server_env', - required=False, - readonly=True) - - @api.depends() - def _compute_server_env(self): - for server in self: - global_section_name = 'outgoing_mail' - - # default vals - config_vals = {'smtp_port': 587} - if serv_config.has_section(global_section_name): - config_vals.update((serv_config.items(global_section_name))) - - custom_section_name = '.'.join((global_section_name, server.name)) - if serv_config.has_section(custom_section_name): - config_vals.update(serv_config.items(custom_section_name)) - - if config_vals.get('smtp_port'): - config_vals['smtp_port'] = int(config_vals['smtp_port']) - - server.update(config_vals) + _name = "ir.mail_server" + _inherit = ["ir.mail_server", "server.env.mixin"] + + @property + def _server_env_fields(self): + base_fields = super()._server_env_fields + mail_fields = { + "smtp_host": {}, + "smtp_port": { + "getter": "getint", + }, + "smtp_user": {}, + "smtp_pass": {}, + "smtp_encryption": {}, + } + mail_fields.update(base_fields) + return mail_fields + + @api.model + def _server_env_global_section_name(self): + """Name of the global section in the configuration files + + Can be customized in your model + """ + return 'outgoing_mail' diff --git a/mail_environment/views/fetchmail_server_views.xml b/mail_environment/views/fetchmail_server_views.xml deleted file mode 100644 index 0c7f1134e..000000000 --- a/mail_environment/views/fetchmail_server_views.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - fetchmail.server - - - - - - - - - - - - - - - - - - From b3de727a0d02f186393b781e0764b3bb864292bb Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Tue, 24 Jul 2018 13:39:22 +0200 Subject: [PATCH 19/52] Infer configparser getter from field type --- mail_environment/models/fetchmail_server.py | 16 ++++------------ mail_environment/models/ir_mail_server.py | 4 +--- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/mail_environment/models/fetchmail_server.py b/mail_environment/models/fetchmail_server.py index ed3331243..2e891c7ed 100644 --- a/mail_environment/models/fetchmail_server.py +++ b/mail_environment/models/fetchmail_server.py @@ -15,21 +15,13 @@ def _server_env_fields(self): base_fields = super()._server_env_fields mail_fields = { "server": {}, - "port": { - "getter": "getint", - }, + "port": {}, "type": {}, "user": {}, "password": {}, - "is_ssl": { - "getter": "getbool", - }, - "attach": { - "getter": "getbool", - }, - "original": { - "getter": "getbool", - }, + "is_ssl": {}, + "attach": {}, + "original": {}, } mail_fields.update(base_fields) return mail_fields diff --git a/mail_environment/models/ir_mail_server.py b/mail_environment/models/ir_mail_server.py index b1d53ceeb..7f3c7afee 100644 --- a/mail_environment/models/ir_mail_server.py +++ b/mail_environment/models/ir_mail_server.py @@ -13,9 +13,7 @@ def _server_env_fields(self): base_fields = super()._server_env_fields mail_fields = { "smtp_host": {}, - "smtp_port": { - "getter": "getint", - }, + "smtp_port": {}, "smtp_user": {}, "smtp_pass": {}, "smtp_encryption": {}, From 94b74e4f1cb697d7432ce08222d7fd2bd94e2dd7 Mon Sep 17 00:00:00 2001 From: sebalix Date: Fri, 4 Jan 2019 11:36:11 +0100 Subject: [PATCH 20/52] [IMP] mail_environment: new README structure --- mail_environment/README.rst | 64 ++- mail_environment/readme/CONFIGURE.rst | 40 ++ mail_environment/readme/CONTRIBUTORS.rst | 6 + mail_environment/readme/DESCRIPTION.rst | 3 + mail_environment/readme/INSTALL.rst | 2 + mail_environment/readme/ROADMAP.rst | 2 + mail_environment/readme/USAGE.rst | 3 + .../static/description/index.html | 488 ++++++++++++++++++ 8 files changed, 589 insertions(+), 19 deletions(-) create mode 100644 mail_environment/readme/CONFIGURE.rst create mode 100644 mail_environment/readme/CONTRIBUTORS.rst create mode 100644 mail_environment/readme/DESCRIPTION.rst create mode 100644 mail_environment/readme/INSTALL.rst create mode 100644 mail_environment/readme/ROADMAP.rst create mode 100644 mail_environment/readme/USAGE.rst create mode 100644 mail_environment/static/description/index.html diff --git a/mail_environment/README.rst b/mail_environment/README.rst index 4093b45df..190904d55 100644 --- a/mail_environment/README.rst +++ b/mail_environment/README.rst @@ -1,15 +1,39 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ========================================== Mail configuration with server_environment ========================================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--env-lightgray.png?logo=github + :target: https://github.com/OCA/server-env/tree/12.0/mail_environment + :alt: OCA/server-env +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-env-12-0/server-env-12-0-mail_environment + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/254/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module allows to configure the incoming and outgoing mail servers using the `server_environment` mechanism: you can then have different mail servers for the production and the test environment. +**Table of contents** + +.. contents:: + :local: + Installation ============ @@ -60,7 +84,6 @@ You will need to create 2 records in the database, one outgoing mail server with the field `name` set to "odoo_smtp_server1" and one incoming mail server with the field `name` set to "odoo_pop_mail1". - Usage ===== @@ -68,7 +91,6 @@ Once configured, Odoo will read the mail servers values from the configuration file related to each environment defined in the main Odoo file. - Known issues / Roadmap ====================== @@ -78,21 +100,23 @@ Known issues / Roadmap Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smash it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Camptocamp Contributors ------------- +~~~~~~~~~~~~ * Nicolas Bessi * Yannick Vaucher @@ -101,17 +125,19 @@ Contributors * Holger Brunn * Alexandre Fayolle -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/server-env `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_environment/readme/CONFIGURE.rst b/mail_environment/readme/CONFIGURE.rst new file mode 100644 index 000000000..439c6be8b --- /dev/null +++ b/mail_environment/readme/CONFIGURE.rst @@ -0,0 +1,40 @@ +With this module installed, the incoming and outgoing mail servers are +configured in the `server_environment_files` module (which is a module +you should provide, see the documentation of `server_environment` for +more information). + +In the configuration file of each environment, you may first use the +sections `[outgoing_mail]` and `[incoming_mail]` to configure the +default values respectively for SMTP servers and the IMAP/POP servers. + +Then for each server, you can define additional values or override the +default values with a section named `[outgoing_mail.resource_name]` or +`[incoming_mail.resource_name]` where "resource_name" is the name of +the server. + +Example of config file :: + + [outgoing_mail] + smtp_host = smtp.myserver.com + smtp_port = 587 + smtp_user = + smtp_pass = + smtp_encryption = ssl + + [outgoing_mail.odoo_smtp_server1] + smtp_user = odoo + smtp_pass = odoo + + [incoming_mail.odoo_pop_mail1] + server = mail.myserver.com + port = 110 + type = pop + is_ssl = 0 + attach = 0 + original = 0 + user = odoo@myserver.com + password = uas1ohV0 + +You will need to create 2 records in the database, one outgoing mail +server with the field `name` set to "odoo_smtp_server1" and one +incoming mail server with the field `name` set to "odoo_pop_mail1". diff --git a/mail_environment/readme/CONTRIBUTORS.rst b/mail_environment/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..a3fe21ed0 --- /dev/null +++ b/mail_environment/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Nicolas Bessi +* Yannick Vaucher +* Guewen Baconnier +* Joël Grand-Guillaume +* Holger Brunn +* Alexandre Fayolle diff --git a/mail_environment/readme/DESCRIPTION.rst b/mail_environment/readme/DESCRIPTION.rst new file mode 100644 index 000000000..d1ac368a0 --- /dev/null +++ b/mail_environment/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows to configure the incoming and outgoing mail servers +using the `server_environment` mechanism: you can then have different +mail servers for the production and the test environment. diff --git a/mail_environment/readme/INSTALL.rst b/mail_environment/readme/INSTALL.rst new file mode 100644 index 000000000..9b4807850 --- /dev/null +++ b/mail_environment/readme/INSTALL.rst @@ -0,0 +1,2 @@ +To install this module, you need to have the server_environment module +installed and properly configured. diff --git a/mail_environment/readme/ROADMAP.rst b/mail_environment/readme/ROADMAP.rst new file mode 100644 index 000000000..647e064ba --- /dev/null +++ b/mail_environment/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +* Due to the special nature of this addon, you cannot test it on the OCA + runbot. diff --git a/mail_environment/readme/USAGE.rst b/mail_environment/readme/USAGE.rst new file mode 100644 index 000000000..735c18b9b --- /dev/null +++ b/mail_environment/readme/USAGE.rst @@ -0,0 +1,3 @@ +Once configured, Odoo will read the mail servers values from the +configuration file related to each environment defined in the main +Odoo file. diff --git a/mail_environment/static/description/index.html b/mail_environment/static/description/index.html new file mode 100644 index 000000000..67f8d8f4d --- /dev/null +++ b/mail_environment/static/description/index.html @@ -0,0 +1,488 @@ + + + + + + +Mail configuration with server_environment + + + +
+

Mail configuration with server_environment

+ + +

Beta License: AGPL-3 OCA/server-env Translate me on Weblate Try me on Runbot

+

This module allows to configure the incoming and outgoing mail servers +using the server_environment mechanism: you can then have different +mail servers for the production and the test environment.

+

Table of contents

+ +
+

Installation

+

To install this module, you need to have the server_environment module +installed and properly configured.

+
+
+

Configuration

+

With this module installed, the incoming and outgoing mail servers are +configured in the server_environment_files module (which is a module +you should provide, see the documentation of server_environment for +more information).

+

In the configuration file of each environment, you may first use the +sections [outgoing_mail] and [incoming_mail] to configure the +default values respectively for SMTP servers and the IMAP/POP servers.

+

Then for each server, you can define additional values or override the +default values with a section named [outgoing_mail.resource_name] or +[incoming_mail.resource_name] where “resource_name” is the name of +the server.

+

Example of config file

+
+[outgoing_mail]
+smtp_host = smtp.myserver.com
+smtp_port = 587
+smtp_user =
+smtp_pass =
+smtp_encryption = ssl
+
+[outgoing_mail.odoo_smtp_server1]
+smtp_user = odoo
+smtp_pass = odoo
+
+[incoming_mail.odoo_pop_mail1]
+server = mail.myserver.com
+port = 110
+type = pop
+is_ssl = 0
+attach = 0
+original = 0
+user = odoo@myserver.com
+password = uas1ohV0
+
+

You will need to create 2 records in the database, one outgoing mail +server with the field name set to “odoo_smtp_server1” and one +incoming mail server with the field name set to “odoo_pop_mail1”.

+
+
+

Usage

+

Once configured, Odoo will read the mail servers values from the +configuration file related to each environment defined in the main +Odoo file.

+
+
+

Known issues / Roadmap

+
    +
  • Due to the special nature of this addon, you cannot test it on the OCA +runbot.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/server-env project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + From ba1e24bfcde711f72660712437d63ced243aed42 Mon Sep 17 00:00:00 2001 From: sebalix Date: Fri, 4 Jan 2019 11:40:58 +0100 Subject: [PATCH 21/52] [MIG] mail_environment: Migration to 12.0 --- mail_environment/__manifest__.py | 3 +- mail_environment/i18n/de.po | 36 +++++++++++--- mail_environment/i18n/en.po | 36 +++++++++++--- mail_environment/i18n/es.po | 29 +++++++++-- mail_environment/i18n/hr.po | 39 ++++++++++++--- mail_environment/i18n/mail_environment.pot | 45 ++++++++++++++++++ mail_environment/i18n/pt_BR.po | 37 ++++++++++++-- mail_environment/i18n/sl.po | 39 ++++++++++++--- mail_environment/i18n/zh_CN.po | 36 +++++++++++--- mail_environment/static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 2 +- 11 files changed, 259 insertions(+), 43 deletions(-) create mode 100644 mail_environment/i18n/mail_environment.pot create mode 100644 mail_environment/static/description/icon.png diff --git a/mail_environment/__manifest__.py b/mail_environment/__manifest__.py index 46a4b8265..188ad1693 100644 --- a/mail_environment/__manifest__.py +++ b/mail_environment/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Mail configuration with server_environment', - 'version': '11.0.1.1.0', + 'version': '12.0.1.0.0', 'category': 'Tools', 'summary': 'Configure mail servers with server_environment_files', 'author': "Camptocamp, Odoo Community Association (OCA)", @@ -13,5 +13,4 @@ 'fetchmail', 'server_environment', ], - 'data': [], } diff --git a/mail_environment/i18n/de.po b/mail_environment/i18n/de.po index 0be52af5f..2f63945f3 100644 --- a/mail_environment/i18n/de.po +++ b/mail_environment/i18n/de.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * mail_environment -# +# # Translators: # Rudolf Schnapka , 2016 msgid "" @@ -11,19 +11,43 @@ msgstr "" "POT-Creation-Date: 2016-04-17 12:15+0000\n" "PO-Revision-Date: 2016-04-21 09:16+0000\n" "Last-Translator: Rudolf Schnapka \n" -"Language-Team: German (http://www.transifex.com/oca/OCA-server-tools-9-0/language/de/)\n" +"Language-Team: German (http://www.transifex.com/oca/OCA-server-tools-9-0/" +"language/de/)\n" +"Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: mail_environment -#: model:ir.model,name:mail_environment.model_fetchmail_server -msgid "POP/IMAP Server" +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "IMAP Server" msgstr "POP/IMAP-Server" +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "Local Server" +msgstr "" + #. module: mail_environment #: model:ir.model,name:mail_environment.model_ir_mail_server -msgid "ir.mail_server" +#, fuzzy +msgid "Mail Server" msgstr "ir.mail_server" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "POP Server" +msgstr "POP/IMAP-Server" + +#. module: mail_environment +#: model:ir.model.fields,field_description:mail_environment.field_fetchmail_server__type +msgid "Server Type" +msgstr "" diff --git a/mail_environment/i18n/en.po b/mail_environment/i18n/en.po index f08797182..d2bd1b909 100644 --- a/mail_environment/i18n/en.po +++ b/mail_environment/i18n/en.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * mail_environment -# +# # Translators: msgid "" msgstr "" @@ -10,19 +10,43 @@ msgstr "" "POT-Creation-Date: 2016-02-27 01:37+0000\n" "PO-Revision-Date: 2016-02-26 16:14+0000\n" "Last-Translator: OCA Transbot \n" -"Language-Team: English (http://www.transifex.com/oca/OCA-server-tools-9-0/language/en/)\n" +"Language-Team: English (http://www.transifex.com/oca/OCA-server-tools-9-0/" +"language/en/)\n" +"Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: en\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: mail_environment -#: model:ir.model,name:mail_environment.model_fetchmail_server -msgid "POP/IMAP Server" +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "IMAP Server" msgstr "POP/IMAP Server" +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "Local Server" +msgstr "" + #. module: mail_environment #: model:ir.model,name:mail_environment.model_ir_mail_server -msgid "ir.mail_server" +#, fuzzy +msgid "Mail Server" msgstr "ir.mail_server" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "POP Server" +msgstr "POP/IMAP Server" + +#. module: mail_environment +#: model:ir.model.fields,field_description:mail_environment.field_fetchmail_server__type +msgid "Server Type" +msgstr "" diff --git a/mail_environment/i18n/es.po b/mail_environment/i18n/es.po index d8565002e..8e8fdeb50 100644 --- a/mail_environment/i18n/es.po +++ b/mail_environment/i18n/es.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * mail_environment -# +# # Translators: # Pedro M. Baeza , 2017 msgid "" @@ -12,18 +12,39 @@ msgstr "" "PO-Revision-Date: 2017-05-01 10:38+0000\n" "Last-Translator: Pedro M. Baeza , 2017\n" "Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "IMAP Server" +msgstr "" + #. module: mail_environment #: model:ir.model,name:mail_environment.model_fetchmail_server -msgid "POP/IMAP Server" +msgid "Incoming Mail Server" +msgstr "" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "Local Server" msgstr "" #. module: mail_environment #: model:ir.model,name:mail_environment.model_ir_mail_server -msgid "ir.mail_server" +#, fuzzy +msgid "Mail Server" msgstr "ir.mail_server" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "POP Server" +msgstr "" + +#. module: mail_environment +#: model:ir.model.fields,field_description:mail_environment.field_fetchmail_server__type +msgid "Server Type" +msgstr "" diff --git a/mail_environment/i18n/hr.po b/mail_environment/i18n/hr.po index bfa25bc99..464b0dd7c 100644 --- a/mail_environment/i18n/hr.po +++ b/mail_environment/i18n/hr.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * mail_environment -# +# # Translators: # Bole , 2016 msgid "" @@ -11,19 +11,44 @@ msgstr "" "POT-Creation-Date: 2016-06-29 00:48+0000\n" "PO-Revision-Date: 2016-06-14 10:58+0000\n" "Last-Translator: Bole \n" -"Language-Team: Croatian (http://www.transifex.com/oca/OCA-server-tools-9-0/language/hr/)\n" +"Language-Team: Croatian (http://www.transifex.com/oca/OCA-server-tools-9-0/" +"language/hr/)\n" +"Language: hr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: hr\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #. module: mail_environment -#: model:ir.model,name:mail_environment.model_fetchmail_server -msgid "POP/IMAP Server" +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "IMAP Server" msgstr "POP/IMAP Server" +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "Local Server" +msgstr "" + #. module: mail_environment #: model:ir.model,name:mail_environment.model_ir_mail_server -msgid "ir.mail_server" +#, fuzzy +msgid "Mail Server" msgstr "ir.mail_server" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "POP Server" +msgstr "POP/IMAP Server" + +#. module: mail_environment +#: model:ir.model.fields,field_description:mail_environment.field_fetchmail_server__type +msgid "Server Type" +msgstr "" diff --git a/mail_environment/i18n/mail_environment.pot b/mail_environment/i18n/mail_environment.pot new file mode 100644 index 000000000..44c12442c --- /dev/null +++ b/mail_environment/i18n/mail_environment.pot @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_environment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "IMAP Server" +msgstr "" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "Local Server" +msgstr "" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_ir_mail_server +msgid "Mail Server" +msgstr "" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "POP Server" +msgstr "" + +#. module: mail_environment +#: model:ir.model.fields,field_description:mail_environment.field_fetchmail_server__type +msgid "Server Type" +msgstr "" + diff --git a/mail_environment/i18n/pt_BR.po b/mail_environment/i18n/pt_BR.po index f929bd3d5..5c0c705f7 100644 --- a/mail_environment/i18n/pt_BR.po +++ b/mail_environment/i18n/pt_BR.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * mail_environment -# +# # Translators: msgid "" msgstr "" @@ -10,14 +10,43 @@ msgstr "" "POT-Creation-Date: 2015-09-29 11:14+0000\n" "PO-Revision-Date: 2015-09-18 13:55+0000\n" "Last-Translator: <>\n" -"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-server-tools-8-0/language/pt_BR/)\n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-server-" +"tools-8-0/language/pt_BR/)\n" +"Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#. module: mail_environment +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "IMAP Server" +msgstr "Servidor POP/IMAP" + #. module: mail_environment #: model:ir.model,name:mail_environment.model_fetchmail_server -msgid "POP/IMAP Server" +msgid "Incoming Mail Server" +msgstr "" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "Local Server" +msgstr "" + +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_ir_mail_server +#, fuzzy +msgid "Mail Server" +msgstr "Servidor POP/IMAP" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "POP Server" msgstr "Servidor POP/IMAP" + +#. module: mail_environment +#: model:ir.model.fields,field_description:mail_environment.field_fetchmail_server__type +msgid "Server Type" +msgstr "" diff --git a/mail_environment/i18n/sl.po b/mail_environment/i18n/sl.po index 03f146fe1..7b0594efe 100644 --- a/mail_environment/i18n/sl.po +++ b/mail_environment/i18n/sl.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * mail_environment -# +# # Translators: # Matjaž Mozetič , 2016 msgid "" @@ -11,19 +11,44 @@ msgstr "" "POT-Creation-Date: 2016-02-27 01:37+0000\n" "PO-Revision-Date: 2016-02-27 16:56+0000\n" "Last-Translator: Matjaž Mozetič \n" -"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-server-tools-9-0/language/sl/)\n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-server-tools-9-0/" +"language/sl/)\n" +"Language: sl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: sl\n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" #. module: mail_environment -#: model:ir.model,name:mail_environment.model_fetchmail_server -msgid "POP/IMAP Server" +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "IMAP Server" msgstr "POP/IMAP strežnik" +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "Local Server" +msgstr "" + #. module: mail_environment #: model:ir.model,name:mail_environment.model_ir_mail_server -msgid "ir.mail_server" +#, fuzzy +msgid "Mail Server" msgstr "ir.mail_server" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "POP Server" +msgstr "POP/IMAP strežnik" + +#. module: mail_environment +#: model:ir.model.fields,field_description:mail_environment.field_fetchmail_server__type +msgid "Server Type" +msgstr "" diff --git a/mail_environment/i18n/zh_CN.po b/mail_environment/i18n/zh_CN.po index 6836584c0..ee795ce57 100644 --- a/mail_environment/i18n/zh_CN.po +++ b/mail_environment/i18n/zh_CN.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * mail_environment -# +# # Translators: # Jeffery Chenn , 2016 msgid "" @@ -11,19 +11,43 @@ msgstr "" "POT-Creation-Date: 2016-08-31 11:58+0000\n" "PO-Revision-Date: 2016-09-04 06:08+0000\n" "Last-Translator: Jeffery Chenn \n" -"Language-Team: Chinese (China) (http://www.transifex.com/oca/OCA-server-tools-9-0/language/zh_CN/)\n" +"Language-Team: Chinese (China) (http://www.transifex.com/oca/OCA-server-" +"tools-9-0/language/zh_CN/)\n" +"Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: zh_CN\n" "Plural-Forms: nplurals=1; plural=0;\n" #. module: mail_environment -#: model:ir.model,name:mail_environment.model_fetchmail_server -msgid "POP/IMAP Server" +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "IMAP Server" msgstr "POP/IMAP 服务器" +#. module: mail_environment +#: model:ir.model,name:mail_environment.model_fetchmail_server +msgid "Incoming Mail Server" +msgstr "" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +msgid "Local Server" +msgstr "" + #. module: mail_environment #: model:ir.model,name:mail_environment.model_ir_mail_server -msgid "ir.mail_server" +#, fuzzy +msgid "Mail Server" +msgstr "POP/IMAP 服务器" + +#. module: mail_environment +#: selection:fetchmail.server,type:0 +#, fuzzy +msgid "POP Server" +msgstr "POP/IMAP 服务器" + +#. module: mail_environment +#: model:ir.model.fields,field_description:mail_environment.field_fetchmail_server__type +msgid "Server Type" msgstr "" diff --git a/mail_environment/static/description/icon.png b/mail_environment/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*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gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/mail_environment/static/description/index.html b/mail_environment/static/description/index.html index 67f8d8f4d..5ef4e10df 100644 --- a/mail_environment/static/description/index.html +++ b/mail_environment/static/description/index.html @@ -3,7 +3,7 @@ - + Mail configuration with server_environment -
-

Mail configuration with server_environment

+
+ + +Odoo Community Association + +
+

Mail configuration with server_environment

-

Beta License: AGPL-3 OCA/server-env Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/server-env Translate me on Weblate Try me on Runboat

This module allows to configure the incoming and outgoing mail servers using the server_environment mechanism: you can then have different mail servers for the production and the test environment.

@@ -390,12 +395,12 @@

Mail configuration with server_environment

-

Installation

+

Installation

To install this module, you need to have the server_environment module installed and properly configured.

-

Configuration

+

Configuration

With this module installed, the incoming and outgoing mail servers are configured in the server_environment_files module (which is a module you should provide, see the documentation of server_environment for more @@ -435,20 +440,20 @@

Configuration

mail server with the field name set to “odoo_pop_mail1”.

-

Usage

+

Usage

Once configured, Odoo will read the mail servers values from the configuration file related to each environment defined in the main Odoo file.

-

Known issues / Roadmap

+

Known issues / Roadmap

    -
  • Due to the special nature of this addon, you cannot test it on the -OCA runbot.
  • +
  • Due to the special nature of this addon, you cannot test it on the OCA +runbot.
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -456,15 +461,15 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Camptocamp
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -488,5 +493,6 @@

Maintainers

+
From 9e695097284489711c41f9864ed99683724353ff Mon Sep 17 00:00:00 2001 From: Raf Ven Date: Sat, 4 Oct 2025 10:49:49 +0200 Subject: [PATCH 51/52] [MIG] mail_environment: Migration to 19.0 --- mail_environment/README.rst | 26 ++-- mail_environment/__manifest__.py | 2 +- mail_environment/models/fetchmail_server.py | 32 +---- mail_environment/models/ir_mail_server.py | 17 ++- .../static/description/index.html | 10 +- mail_environment/tests/__init__.py | 3 +- mail_environment/tests/test_incoming_mail.py | 118 ++++++++++++++++++ .../tests/test_mail_environment.py | 77 ------------ mail_environment/tests/test_outgoing_mail.py | 91 ++++++++++++++ 9 files changed, 252 insertions(+), 124 deletions(-) create mode 100644 mail_environment/tests/test_incoming_mail.py delete mode 100644 mail_environment/tests/test_mail_environment.py create mode 100644 mail_environment/tests/test_outgoing_mail.py diff --git a/mail_environment/README.rst b/mail_environment/README.rst index ed0aa41a8..aff74827b 100644 --- a/mail_environment/README.rst +++ b/mail_environment/README.rst @@ -21,13 +21,13 @@ Mail configuration with server_environment :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--env-lightgray.png?logo=github - :target: https://github.com/OCA/server-env/tree/18.0/mail_environment + :target: https://github.com/OCA/server-env/tree/19.0/mail_environment :alt: OCA/server-env .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-env-18-0/server-env-18-0-mail_environment + :target: https://translation.odoo-community.org/projects/server-env-19-0/server-env-19-0-mail_environment :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/server-env&target_branch=18.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/server-env&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -103,8 +103,8 @@ file. Known issues / Roadmap ====================== -- Due to the special nature of this addon, you cannot test it on the OCA - runbot. +- Due to the special nature of this addon, you cannot test it on the + OCA runbot. Bug Tracker =========== @@ -112,7 +112,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -127,12 +127,12 @@ Authors Contributors ------------ -- Nicolas Bessi -- Yannick Vaucher -- Guewen Baconnier -- Joël Grand-Guillaume -- Holger Brunn -- Alexandre Fayolle +- Nicolas Bessi +- Yannick Vaucher +- Guewen Baconnier +- Joël Grand-Guillaume +- Holger Brunn +- Alexandre Fayolle Maintainers ----------- @@ -147,6 +147,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/server-env `_ project on GitHub. +This module is part of the `OCA/server-env `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_environment/__manifest__.py b/mail_environment/__manifest__.py index 7bd19de9c..5b66cad4a 100644 --- a/mail_environment/__manifest__.py +++ b/mail_environment/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Mail configuration with server_environment", - "version": "18.0.1.0.1", + "version": "19.0.1.0.0", "category": "Tools", "summary": "Configure mail servers with server_environment_files", "author": "Camptocamp, Odoo Community Association (OCA)", diff --git a/mail_environment/models/fetchmail_server.py b/mail_environment/models/fetchmail_server.py index f0624224e..700cbd9d0 100644 --- a/mail_environment/models/fetchmail_server.py +++ b/mail_environment/models/fetchmail_server.py @@ -1,10 +1,7 @@ # Copyright 2012-2018 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -import operator - from odoo import api, fields, models -from odoo.osv.expression import FALSE_DOMAIN class FetchmailServer(models.Model): @@ -40,31 +37,14 @@ def _server_env_global_section_name(self): """ return "incoming_mail" - @api.model def _search_is_ssl(self, oper, value): - """Keep the is_ssl field searchable to allow domain in search view.""" - if not isinstance(value, bool): - return FALSE_DOMAIN - operators = { - "=": operator.eq, - "!=": operator.ne, - } - if oper not in operators: - return FALSE_DOMAIN - servers = self.search([]).filtered(lambda s: operators[oper](value, s.is_ssl)) - return [("id", "in", servers.ids)] + servers = self.search_fetch([], ["is_ssl"]).filtered_domain( + [("is_ssl", oper, value)] + ) + return fields.Domain([("id", "in", servers.ids)]) - @api.model def _search_server_type(self, oper, value): - operators = { - "=": operator.eq, - "!=": operator.ne, - "in": operator.contains, - "not in": lambda a, b: not operator.contains(a, b), - } - if oper not in operators: - return [("id", "in", [])] - servers = self.search([]).filtered( - lambda s: operators[oper](value, s.server_type) + servers = self.search_fetch([], ["server_type"]).filtered_domain( + [("server_type", oper, value)] ) return [("id", "in", servers.ids)] diff --git a/mail_environment/models/ir_mail_server.py b/mail_environment/models/ir_mail_server.py index 6d85558d0..f8110242c 100644 --- a/mail_environment/models/ir_mail_server.py +++ b/mail_environment/models/ir_mail_server.py @@ -1,7 +1,7 @@ # Copyright 2012-2018 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -from odoo import api, models +from odoo import api, fields, models class IrMailServer(models.Model): @@ -22,6 +22,9 @@ def _server_env_fields(self): mail_fields.update(base_fields) return mail_fields + smtp_user = fields.Char(search="_search_smtp_user") + smtp_host = fields.Char(search="_search_smtp_host") + @api.model def _server_env_global_section_name(self): """Name of the global section in the configuration files @@ -29,3 +32,15 @@ def _server_env_global_section_name(self): Can be customized in your model """ return "outgoing_mail" + + def _search_smtp_user(self, oper, value): + servers = self.search_fetch([], ["smtp_user"]).filtered_domain( + [("smtp_user", oper, value)] + ) + return fields.Domain([("id", "in", servers.ids)]) + + def _search_smtp_host(self, oper, value): + servers = self.search_fetch([], ["smtp_host"]).filtered_domain( + [("smtp_host", oper, value)] + ) + return fields.Domain([("id", "in", servers.ids)]) diff --git a/mail_environment/static/description/index.html b/mail_environment/static/description/index.html index be52611f6..795b56160 100644 --- a/mail_environment/static/description/index.html +++ b/mail_environment/static/description/index.html @@ -374,7 +374,7 @@

Mail configuration with server_environment

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:b27d3ac30fd7cb59d6eed6d0f910db100f70a145e028b2096015bcd7022a33b3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/server-env Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/server-env Translate me on Weblate Try me on Runboat

This module allows to configure the incoming and outgoing mail servers using the server_environment mechanism: you can then have different mail servers for the production and the test environment.

@@ -448,8 +448,8 @@

Usage

Known issues / Roadmap

    -
  • Due to the special nature of this addon, you cannot test it on the OCA -runbot.
  • +
  • Due to the special nature of this addon, you cannot test it on the +OCA runbot.
@@ -457,7 +457,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -488,7 +488,7 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/server-env project on GitHub.

+

This module is part of the OCA/server-env project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/mail_environment/tests/__init__.py b/mail_environment/tests/__init__.py index 82ffeb745..70033f3ae 100644 --- a/mail_environment/tests/__init__.py +++ b/mail_environment/tests/__init__.py @@ -1 +1,2 @@ -from . import test_mail_environment +from . import test_incoming_mail +from . import test_outgoing_mail diff --git a/mail_environment/tests/test_incoming_mail.py b/mail_environment/tests/test_incoming_mail.py new file mode 100644 index 000000000..49b81f6a4 --- /dev/null +++ b/mail_environment/tests/test_incoming_mail.py @@ -0,0 +1,118 @@ +# Copyright 2018 Camptocamp (https://www.camptocamp.com). +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + + +from odoo.addons.server_environment.tests.common import ServerEnvironmentCase + +fetchmail_config = """ +[incoming_mail.fetchmail1] +server = safe_server +port = 993 +server_type = imap +is_ssl = 1 +attach = 1 +original = 1 +user = admin +password = admin +state = done +priority = 1 +active = 1 + +[incoming_mail.fetchmail2] +server = unsafe_server +port = 143 +server_type = imap +is_ssl = 0 +attach = 1 +original = 1 +user = admin +password = admin +state = done +priority = 1 +active = 1 +""" + + +class TestFetchMailEnvironment(ServerEnvironmentCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.FetchmailServer = cls.env["fetchmail.server"] + cls.fetchmail1 = cls.FetchmailServer.create({"name": "fetchmail1"}) + cls.fetchmail2 = cls.FetchmailServer.create({"name": "fetchmail2"}) + + def test_fetchmail_search_is_ssl(self): + with self.load_config(public=fetchmail_config): + # Test basic properties + self.assertTrue(self.fetchmail1.is_ssl) + self.assertEqual(self.fetchmail1.port, 993) + self.assertFalse(self.fetchmail2.is_ssl) + self.assertEqual(self.fetchmail2.port, 143) + + # Test is_ssl search method + self.assertIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("is_ssl", "=", True)]), + ) + self.assertIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("is_ssl", "!=", False)]), + ) + self.assertNotIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("is_ssl", "=", False)]), + ) + self.assertNotIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("is_ssl", "!=", True)]), + ) + self.assertNotIn( + self.fetchmail2, + self.env["fetchmail.server"].search([("is_ssl", "=", True)]), + ) + self.assertNotIn( + self.fetchmail2, + self.env["fetchmail.server"].search([("is_ssl", "!=", False)]), + ) + self.assertIn( + self.fetchmail2, + self.env["fetchmail.server"].search([("is_ssl", "=", False)]), + ) + self.assertIn( + self.fetchmail2, + self.env["fetchmail.server"].search([("is_ssl", "!=", True)]), + ) + + def test_fetchmail_search_server_type(self): + with self.load_config(public=fetchmail_config): + # Test server_type search method + self.assertIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("server_type", "=", "imap")]), + ) + self.assertIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("server_type", "!=", "pop3")]), + ) + self.assertNotIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("server_type", "=", "pop3")]), + ) + self.assertNotIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("server_type", "!=", "imap")]), + ) + self.assertIn( + self.fetchmail1, + self.env["fetchmail.server"].search( + [("server_type", "=ilike", "IMAP")] + ), + ) + self.assertIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("server_type", "ilike", "IM")]), + ) + self.assertNotIn( + self.fetchmail1, + self.env["fetchmail.server"].search([("server_type", "ilike", "POP")]), + ) diff --git a/mail_environment/tests/test_mail_environment.py b/mail_environment/tests/test_mail_environment.py deleted file mode 100644 index 44c396b2c..000000000 --- a/mail_environment/tests/test_mail_environment.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2018 Camptocamp (https://www.camptocamp.com). -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) - - -from odoo.addons.server_environment.tests.common import ServerEnvironmentCase - -fetchmail_config = """ -[incoming_mail.fetchmail1] -server = safe_server -port = 993 -server_type = imap -is_ssl = 1 -attach = 1 -original = 1 -user = admin -password = admin -state = done -priority = 1 -active = 1 - -[incoming_mail.fetchmail2] -server = unsafe_server -port = 143 -server_type = imap -is_ssl = 0 -attach = 1 -original = 1 -user = admin -password = admin -state = done -priority = 1 -active = 1 -""" - - -class TestMailEnvironment(ServerEnvironmentCase): - def test_fetchmail_search_is_ssl(self): - fetchmail1 = self.env["fetchmail.server"].create({"name": "fetchmail1"}) - fetchmail2 = self.env["fetchmail.server"].create({"name": "fetchmail2"}) - with self.load_config(public=fetchmail_config): - # Test basic properties - self.assertTrue(fetchmail1.is_ssl) - self.assertEqual(fetchmail1.port, 993) - self.assertFalse(fetchmail2.is_ssl) - self.assertEqual(fetchmail2.port, 143) - - # Test is_ssl search method - self.assertIn( - fetchmail1, self.env["fetchmail.server"].search([("is_ssl", "=", True)]) - ) - self.assertIn( - fetchmail1, - self.env["fetchmail.server"].search([("is_ssl", "!=", False)]), - ) - self.assertNotIn( - fetchmail1, - self.env["fetchmail.server"].search([("is_ssl", "=", False)]), - ) - self.assertNotIn( - fetchmail1, - self.env["fetchmail.server"].search([("is_ssl", "!=", True)]), - ) - self.assertNotIn( - fetchmail2, self.env["fetchmail.server"].search([("is_ssl", "=", True)]) - ) - self.assertNotIn( - fetchmail2, - self.env["fetchmail.server"].search([("is_ssl", "!=", False)]), - ) - self.assertIn( - fetchmail2, - self.env["fetchmail.server"].search([("is_ssl", "=", False)]), - ) - self.assertIn( - fetchmail2, - self.env["fetchmail.server"].search([("is_ssl", "!=", True)]), - ) diff --git a/mail_environment/tests/test_outgoing_mail.py b/mail_environment/tests/test_outgoing_mail.py new file mode 100644 index 000000000..60f95c908 --- /dev/null +++ b/mail_environment/tests/test_outgoing_mail.py @@ -0,0 +1,91 @@ +from odoo.addons.server_environment.tests.common import ServerEnvironmentCase + +mail_server_config = """ +[outgoing_mail] +smtp_host = smtp.myserver.com +smtp_port = 587 +smtp_user = +smtp_pass = +smtp_encryption = ssl + +[outgoing_mail.mail_server1] +smtp_user = user1 +smtp_pass = password1 + +[outgoing_mail.mail_server2] +smtp_user = user2 +smtp_pass = password2 +""" + + +class TestMailServerEnvironment(ServerEnvironmentCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.mailServer = cls.env["ir.mail_server"] + cls.mail_server1 = cls.mailServer.create({"name": "mail_server1"}) + cls.mail_server2 = cls.mailServer.create({"name": "mail_server2"}) + + def test_mail_server_search_smtp_user(self): + with self.load_config(public=mail_server_config): + # Test basic properties + self.assertEqual(self.mail_server1.smtp_user, "user1") + self.assertEqual(self.mail_server2.smtp_user, "user2") + + # Test smtp_user search method + self.assertIn( + self.mail_server1, + self.env["ir.mail_server"].search([("smtp_user", "=", "user1")]), + ) + self.assertNotIn( + self.mail_server1, + self.env["ir.mail_server"].search([("smtp_user", "!=", "user1")]), + ) + self.assertIn( + self.mail_server2, + self.env["ir.mail_server"].search([("smtp_user", "=", "user2")]), + ) + self.assertNotIn( + self.mail_server2, + self.env["ir.mail_server"].search([("smtp_user", "!=", "user2")]), + ) + self.assertIn( + self.mail_server1, + self.env["ir.mail_server"].search([("smtp_user", "ilike", "user")]), + ) + self.assertIn( + self.mail_server2, + self.env["ir.mail_server"].search([("smtp_user", "ilike", "user")]), + ) + + def test_mail_server_search_smtp_host(self): + with self.load_config(public=mail_server_config): + # Test basic properties + self.assertEqual(self.mail_server1.smtp_host, "smtp.myserver.com") + self.assertEqual(self.mail_server2.smtp_host, "smtp.myserver.com") + + # Test smtp_user search method + self.assertIn( + self.mail_server1, + self.env["ir.mail_server"].search([("smtp_host", "=", "smtp.myserver.com")]), + ) + self.assertNotIn( + self.mail_server1, + self.env["ir.mail_server"].search([("smtp_host", "!=", "smtp.myserver.com")]), + ) + self.assertIn( + self.mail_server2, + self.env["ir.mail_server"].search([("smtp_host", "=", "smtp.myserver.com")]), + ) + self.assertNotIn( + self.mail_server2, + self.env["ir.mail_server"].search([("smtp_host", "!=", "smtp.myserver.com")]), + ) + self.assertIn( + self.mail_server1, + self.env["ir.mail_server"].search([("smtp_host", "ilike", "myserver")]), + ) + self.assertIn( + self.mail_server2, + self.env["ir.mail_server"].search([("smtp_host", "ilike", "myserver")]), + ) From 011eda9fb797d4158c6131ffb63f84f40ed8d4b8 Mon Sep 17 00:00:00 2001 From: Raf Ven Date: Sat, 4 Oct 2025 10:54:53 +0200 Subject: [PATCH 52/52] [DON'T MERGE] test-requirements.txt --- test-requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test-requirements.txt diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..5cbc91106 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-server_environment @ git+https://github.com/OCA/server-env.git@refs/pull/247/head#subdirectory=server_environment