From 3c50eb017a0a6667f70f6f3d32a6d067e609dd18 Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Fri, 22 Jun 2012 12:18:54 +0530 Subject: [IMP] set logging.getLogger(__name__) bzr revid: kjo@tinyerp.com-20120622064854-5f6fss55k7305e8q --- addons/fetchmail/fetchmail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/fetchmail') diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index 93ebd063051..cddcf642dc4 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -39,7 +39,7 @@ from osv import osv, fields import tools from tools.translate import _ -logger = logging.getLogger('fetchmail') +_logger = logging.getLogger(__name__) class fetchmail_server(osv.osv): """Incoming POP/IMAP mail server account""" -- cgit v1.2.3 From 31bc158635ea908b9973ad7d77cf74a4f4046dae Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 25 Jun 2012 11:19:51 +0200 Subject: [IMP] fetchmail: in config wizards, deactivate fetchmail servers when boolean option is unchecked bzr revid: rco@openerp.com-20120625091951-udrlkq2ajamp13ff --- addons/fetchmail/res_config.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'addons/fetchmail') diff --git a/addons/fetchmail/res_config.py b/addons/fetchmail/res_config.py index f7dade6ae33..6655b95ac0e 100644 --- a/addons/fetchmail/res_config.py +++ b/addons/fetchmail/res_config.py @@ -32,7 +32,7 @@ class fetchmail_config_settings(osv.osv_memory): _inherit = ['res.config.settings', 'fetchmail.config.settings'] _columns = { - 'fetchmail_stuff': fields.boolean(..., readonly=True, + 'fetchmail_stuff': fields.boolean(..., fetchmail_model='my.stuff', fetchmail_name='Incoming Stuff'), } @@ -67,6 +67,18 @@ class fetchmail_config_settings(osv.osv_memory): res[f] = bool(server_ids) return res + def set_fetchmail(self, cr, uid, ids, context=None): + """ deactivate fetchmail servers for all fields like 'fetchmail_XXX' that are False """ + config = self.browse(cr, uid, ids[0], context) + fetchmail_fields = [f for f in self._columns if f.startswith('fetchmail_')] + # determine which models should not have active fetchmail servers, and + # deactivate all active servers for those models + models = [self._columns[f].fetchmail_model for f in fetchmail_fields if not config[f]] + if models: + fetchmail_server = self.pool.get('fetchmail.server') + server_ids = fetchmail_server.search(cr, uid, [('object_id.model', 'in', models), ('state', '=', 'done')]) + fetchmail_server.set_draft(cr, uid, server_ids, context) + def configure_fetchmail(self, cr, uid, field, context=None): """ open the form view of the fetchmail.server to configure """ action = { -- cgit v1.2.3 From 863a810f1580cfdf7b698cb8698fc30759af6da6 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 29 Jun 2012 15:41:51 +0200 Subject: [FIX] base_setup, fetchmail: add target in action methods opening a form view bzr revid: rco@openerp.com-20120629134151-oqharq4xhylq3fze --- addons/fetchmail/res_config.py | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/fetchmail') diff --git a/addons/fetchmail/res_config.py b/addons/fetchmail/res_config.py index 6655b95ac0e..f2447ce7b94 100644 --- a/addons/fetchmail/res_config.py +++ b/addons/fetchmail/res_config.py @@ -85,6 +85,7 @@ class fetchmail_config_settings(osv.osv_memory): 'type': 'ir.actions.act_window', 'res_model': 'fetchmail.server', 'view_mode': 'form', + 'target': 'current', } model_name = self._columns[field].fetchmail_model model_id = self.pool.get('ir.model').search(cr, uid, [('model', '=', model_name)])[0] -- cgit v1.2.3 From d973fc8f5735e354632d22301806216480694226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 2 Jul 2012 10:47:00 +0200 Subject: [FIX] fetchmail: fixed var used with a typo inside. bzr revid: tde@openerp.com-20120702084700-sei3ip60afywo222 --- addons/fetchmail/fetchmail.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'addons/fetchmail') diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index cddcf642dc4..55923c3043a 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -151,7 +151,7 @@ openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOS connection = server.connect() server.write({'state':'done'}) except Exception, e: - logger.exception("Failed to connect to %s server %s", server.type, server.name) + _logger.exception("Failed to connect to %s server %s", server.type, server.name) raise osv.except_osv(_("Connection test failed!"), _("Here is what we got instead:\n %s") % tools.ustr(e)) finally: try: @@ -177,7 +177,7 @@ openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOS mail_thread = self.pool.get('mail.thread') action_pool = self.pool.get('ir.actions.server') for server in self.browse(cr, uid, ids, context=context): - logger.info('start checking for new emails on %s server %s', server.type, server.name) + _logger.info('start checking for new emails on %s server %s', server.type, server.name) context.update({'fetchmail_server_id': server.id, 'server_type': server.type}) count = 0 imap_server = False @@ -198,9 +198,9 @@ openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOS imap_server.store(num, '+FLAGS', '\\Seen') cr.commit() count += 1 - logger.info("fetched/processed %s email(s) on %s server %s", count, server.type, server.name) + _logger.info("fetched/processed %s email(s) on %s server %s", count, server.type, server.name) except Exception, e: - logger.exception("Failed to fetch mail from %s server %s", server.type, server.name) + _logger.exception("Failed to fetch mail from %s server %s", server.type, server.name) finally: if imap_server: imap_server.close() @@ -222,9 +222,9 @@ openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOS action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]}) pop_server.dele(num) cr.commit() - logger.info("fetched/processed %s email(s) on %s server %s", numMsgs, server.type, server.name) + _logger.info("fetched/processed %s email(s) on %s server %s", numMsgs, server.type, server.name) except Exception, e: - logger.exception("Failed to fetch mail from %s server %s", server.type, server.name) + _logger.exception("Failed to fetch mail from %s server %s", server.type, server.name) finally: if pop_server: pop_server.quit() -- cgit v1.2.3