From 9f1bd5952251b0a16e8fd703b559cd57120250c3 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 15 Apr 2013 14:23:05 +0200 Subject: [PATCH] [ADD] msg_state field for folders - set the state of messages fetched from imap servers [IMP] clean up the folders' treeview --- .../model/fetchmail_server.py | 1 + .../model/fetchmail_server_folder.py | 11 ++++++++++- .../view/fetchmail_server.xml | 17 ++++++----------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/fetchmail_attach_from_folder/model/fetchmail_server.py b/fetchmail_attach_from_folder/model/fetchmail_server.py index 3448351e8..9b9085042 100644 --- a/fetchmail_attach_from_folder/model/fetchmail_server.py +++ b/fetchmail_attach_from_folder/model/fetchmail_server.py @@ -159,6 +159,7 @@ class fetchmail_server(Model): 'message_id': mail_message.get('message-id'), 'subtype': mail_message.get('subtype'), 'headers': mail_message.get('headers'), + 'state': folder.msg_state, }, context) if this.attach: diff --git a/fetchmail_attach_from_folder/model/fetchmail_server_folder.py b/fetchmail_attach_from_folder/model/fetchmail_server_folder.py index 1043a2e41..ea0c07a7b 100644 --- a/fetchmail_attach_from_folder/model/fetchmail_server_folder.py +++ b/fetchmail_attach_from_folder/model/fetchmail_server_folder.py @@ -87,11 +87,20 @@ class fetchmail_server_folder(Model): 'not checked, multiple matches count as no match at all'), 'domain': fields.char( 'Domain', size=128, help='Fill in a search ' - 'filter to narrow down objects to match') + 'filter to narrow down objects to match'), + 'msg_state': fields.selection( + [ + ('sent', 'Sent'), + ('received', 'Received'), + ], + 'Message state', + help='The state messages fetched from this folder should be ' + 'assigned in OpenERP'), } _defaults = { 'flag_nonmatching': True, + 'msg_state': 'received', } def get_algorithm(self, cr, uid, ids, context=None): diff --git a/fetchmail_attach_from_folder/view/fetchmail_server.xml b/fetchmail_attach_from_folder/view/fetchmail_server.xml index 043090cb4..1178eec0a 100644 --- a/fetchmail_attach_from_folder/view/fetchmail_server.xml +++ b/fetchmail_attach_from_folder/view/fetchmail_server.xml @@ -26,17 +26,6 @@ - - - - - -