[FIX] Add fnct_search on type in order to avoid error when ir.cron run the fetch task
parent
63db4d67ae
commit
a5889e6729
|
@ -128,6 +128,29 @@ class FetchmailServer(osv.osv):
|
||||||
res[fetchmail.id] = config_vals
|
res[fetchmail.id] = config_vals
|
||||||
return res
|
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 = {
|
_columns = {
|
||||||
'server': fields.function(_get_incom_conf,
|
'server': fields.function(_get_incom_conf,
|
||||||
method=True,
|
method=True,
|
||||||
|
@ -146,6 +169,7 @@ class FetchmailServer(osv.osv):
|
||||||
string='Type',
|
string='Type',
|
||||||
type="char",
|
type="char",
|
||||||
multi='income_mail_config',
|
multi='income_mail_config',
|
||||||
|
fnct_search=_type_search,
|
||||||
size=64,
|
size=64,
|
||||||
help="pop, imap, local"),
|
help="pop, imap, local"),
|
||||||
'is_ssl': fields.function(_get_incom_conf,
|
'is_ssl': fields.function(_get_incom_conf,
|
||||||
|
|
Loading…
Reference in New Issue