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 @@