diff --git a/fetchmail_view.xml b/fetchmail_view.xml index e83d2d74..7a63ad83 100644 --- a/fetchmail_view.xml +++ b/fetchmail_view.xml @@ -3,17 +3,14 @@ - fetchmail.server.form fetchmail.server - form - - + diff --git a/file_document.py b/file_document.py index af5277c8..7e26412c 100644 --- a/file_document.py +++ b/file_document.py @@ -35,6 +35,39 @@ class file_document(orm.Model): 'The combination of Email Server and External id must be unique !'), ] + + def message_process(self, cr, uid, model, message, custom_values=None, + save_original=False, strip_attachments=False, + thread_id=None, context=None): + if context is None: + context = {} + context['no_post'] = True + return super(file_document, self).message_process(self, cr, uid, model, + message, + custom_values=custom_values, + save_original=save_original, + strip_attachments=strip_attachments, + thread_id=thread_id, + context=context) + + def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', + subtype=None, parent_id=False, attachments=None, context=None, + content_subtype='html', **kwargs): + if context.get('no_post'): + return None + return super(file_document, self).message_post(cr, uid, thread_id, + body=body, + subject=subject, + type='notification', + subtype=subtype, + parent_id=parent_id, + attachments=attachments, + context=context, + content_subtype=content_subtype, + **kwargs) + + + def _prepare_data_for_file_document(self, cr, uid, msg, context=None): """Method to prepare the data for creating a file document. :param msg: a dictionnary with the email data @@ -56,5 +89,8 @@ class file_document(orm.Model): if not key in vals: vals[key] = default[key] created_ids.append(self.create(cr, uid, vals, context=context)) - return created_ids + cr.commit() + context['created_ids'] = created_ids + return created_ids[0] return None +