From 63db4d67ae38c887e49777823cfdec55cb197bf5 Mon Sep 17 00:00:00 2001 From: Joel Grand-Guillaume Date: Fri, 8 Nov 2013 12:14:26 +0100 Subject: [PATCH 1/2] [MIGR] Mark the mail_environnement module as installable = True as it works on v 7.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 5da871afb..fce396f8d 100644 --- a/mail_environment/__openerp__.py +++ b/mail_environment/__openerp__.py @@ -61,7 +61,7 @@ password = openerp 'init_xml': [], 'update_xml': ['mail_view.xml'], 'demo_xml': [], - 'installable': False, + 'installable': True, 'active': False, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From a5889e6729fa7d8ae116b07369d07de892c1885a Mon Sep 17 00:00:00 2001 From: Joel Grand-Guillaume Date: Fri, 8 Nov 2013 15:06:53 +0100 Subject: [PATCH 2/2] [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 @@ class FetchmailServer(osv.osv): 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 @@ class FetchmailServer(osv.osv): 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,