From f9441a7847dde0f658a9c2a33d7fa310be25ebd6 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 29 Sep 2015 20:11:12 +0200 Subject: [PATCH] [FIX] disable rollbacks in matching code --- fetchmail_attach_from_folder/model/fetchmail_server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fetchmail_attach_from_folder/model/fetchmail_server.py b/fetchmail_attach_from_folder/model/fetchmail_server.py index efd5262d4..d5fc78f57 100644 --- a/fetchmail_attach_from_folder/model/fetchmail_server.py +++ b/fetchmail_attach_from_folder/model/fetchmail_server.py @@ -150,17 +150,22 @@ class fetchmail_server(Model): folder.match_first): try: cr.execute('savepoint apply_matching') + # OpenERP 6.1 does a rollback on validation errors + rollback_org = cr.rollback + cr.rollback = lambda: None match_algorithm.handle_match( cr, uid, connection, found_ids[0], folder, mail_message, msgdata[0][1], msgid, context) + cr.rollback = rollback_org cr.execute('release savepoint apply_matching') matched_object_ids += found_ids[:1] except Exception: - cr.execute('rollback to savepoint apply_matching') logger.exception( "Failed to fetch mail %s from %s", msgid, this.name) + cr.rollback = rollback_org + cr.execute('rollback to savepoint apply_matching') elif folder.flag_nonmatching: connection.store(msgid, '+FLAGS', '\\FLAGGED')