Browse Source

[ADD] msg_state field for folders - set the state of messages fetched

from imap servers
[IMP] clean up the folders' treeview
pull/78/head
Holger Brunn 12 years ago
parent
commit
9f1bd59522
  1. 1
      fetchmail_attach_from_folder/model/fetchmail_server.py
  2. 11
      fetchmail_attach_from_folder/model/fetchmail_server_folder.py
  3. 17
      fetchmail_attach_from_folder/view/fetchmail_server.xml

1
fetchmail_attach_from_folder/model/fetchmail_server.py

@ -159,6 +159,7 @@ class fetchmail_server(Model):
'message_id': mail_message.get('message-id'), 'message_id': mail_message.get('message-id'),
'subtype': mail_message.get('subtype'), 'subtype': mail_message.get('subtype'),
'headers': mail_message.get('headers'), 'headers': mail_message.get('headers'),
'state': folder.msg_state,
}, },
context) context)
if this.attach: if this.attach:

11
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'), 'not checked, multiple matches count as no match at all'),
'domain': fields.char( 'domain': fields.char(
'Domain', size=128, help='Fill in a search ' '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 = { _defaults = {
'flag_nonmatching': True, 'flag_nonmatching': True,
'msg_state': 'received',
} }
def get_algorithm(self, cr, uid, ids, context=None): def get_algorithm(self, cr, uid, ids, context=None):

17
fetchmail_attach_from_folder/view/fetchmail_server.xml

@ -26,17 +26,6 @@
<field name="model_field" /> <field name="model_field" />
<field name="match_algorithm" /> <field name="match_algorithm" />
<field name="mail_field" /> <field name="mail_field" />
<field name="delete_matching" />
<field name="flag_nonmatching" />
<field name="match_first" />
<field
name="model_order"
attrs="{'readonly': [('match_first','==',False)], 'required': [('match_first','==',True)]}" />
<field name="domain" />
<button type="object"
name="button_attach_mail_manually"
string="Attach mail manually"
icon="gtk-redo" />
</tree> </tree>
<form col="6"> <form col="6">
<field name="path" /> <field name="path" />
@ -48,8 +37,14 @@
<field name="delete_matching" /> <field name="delete_matching" />
<field name="flag_nonmatching" /> <field name="flag_nonmatching" />
<field name="match_first" /> <field name="match_first" />
<field name="msg_state" />
<field name="model_order" attrs="{'readonly': [('match_first','==',False)], 'required': [('match_first','==',True)]}" /> <field name="model_order" attrs="{'readonly': [('match_first','==',False)], 'required': [('match_first','==',True)]}" />
<field name="domain" /> <field name="domain" />
<newline />
<label />
<label />
<label />
<label />
<label /> <label />
<button type="object" name="button_attach_mail_manually" string="Attach mail manually" icon="gtk-redo" /> <button type="object" name="button_attach_mail_manually" string="Attach mail manually" icon="gtk-redo" />
</form> </form>

Loading…
Cancel
Save