Merge pull request #205 from hbrunn/8.0-fetchmail_attach_from_folder
[ADD] honor sequence, add active flagpull/272/head
commit
012c308c76
|
@ -33,7 +33,8 @@ class fetchmail_server(models.Model):
|
||||||
_inherit = 'fetchmail.server'
|
_inherit = 'fetchmail.server'
|
||||||
|
|
||||||
folder_ids = fields.One2many(
|
folder_ids = fields.One2many(
|
||||||
'fetchmail.server.folder', 'server_id', 'Folders')
|
'fetchmail.server.folder', 'server_id', 'Folders',
|
||||||
|
context={'active_test': False})
|
||||||
object_id = fields.Many2one(required=False)
|
object_id = fields.Many2one(required=False)
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -67,7 +68,7 @@ class fetchmail_server(models.Model):
|
||||||
})
|
})
|
||||||
|
|
||||||
connection = this.connect()
|
connection = this.connect()
|
||||||
for folder in this.folder_ids:
|
for folder in this.folder_ids.filtered('active'):
|
||||||
this.handle_folder(connection, folder)
|
this.handle_folder(connection, folder)
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
|
@ -216,7 +217,7 @@ class fetchmail_server(models.Model):
|
||||||
this.write({'state': 'draft'})
|
this.write({'state': 'draft'})
|
||||||
connection = this.connect()
|
connection = this.connect()
|
||||||
connection.select()
|
connection.select()
|
||||||
for folder in this.folder_ids:
|
for folder in this.folder_ids.filtered('active'):
|
||||||
if connection.select(folder.path)[0] != 'OK':
|
if connection.select(folder.path)[0] != 'OK':
|
||||||
raise exceptions.ValidationError(
|
raise exceptions.ValidationError(
|
||||||
_('Mailbox %s not found!') % folder.path)
|
_('Mailbox %s not found!') % folder.path)
|
||||||
|
|
|
@ -26,6 +26,7 @@ from .. import match_algorithm
|
||||||
class fetchmail_server_folder(models.Model):
|
class fetchmail_server_folder(models.Model):
|
||||||
_name = 'fetchmail.server.folder'
|
_name = 'fetchmail.server.folder'
|
||||||
_rec_name = 'path'
|
_rec_name = 'path'
|
||||||
|
_order = 'sequence'
|
||||||
|
|
||||||
def _get_match_algorithms(self):
|
def _get_match_algorithms(self):
|
||||||
def get_all_subclasses(cls):
|
def get_all_subclasses(cls):
|
||||||
|
@ -93,10 +94,12 @@ class fetchmail_server_folder(models.Model):
|
||||||
'Message state',
|
'Message state',
|
||||||
help='The state messages fetched from this folder should be '
|
help='The state messages fetched from this folder should be '
|
||||||
'assigned in Odoo')
|
'assigned in Odoo')
|
||||||
|
active = fields.Boolean('Active')
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'flag_nonmatching': True,
|
'flag_nonmatching': True,
|
||||||
'msg_state': 'received',
|
'msg_state': 'received',
|
||||||
|
'active': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
name="folder_ids"
|
name="folder_ids"
|
||||||
nolabel="1"
|
nolabel="1"
|
||||||
on_change="onchange_server_type(type, is_ssl, object_id)">
|
on_change="onchange_server_type(type, is_ssl, object_id)">
|
||||||
<tree>
|
<tree colors="gray:active==False">
|
||||||
<field name="sequence" invisible="1" />
|
<field name="active" invisible="True" />
|
||||||
|
<field name="sequence" widget="handle" />
|
||||||
<field name="path" />
|
<field name="path" />
|
||||||
<field name="model_id" />
|
<field name="model_id" />
|
||||||
<field name="model_field" />
|
<field name="model_field" />
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
<field name="mail_field" placeholder="to,from" />
|
<field name="mail_field" placeholder="to,from" />
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
|
<field name="active" />
|
||||||
<field name="delete_matching" />
|
<field name="delete_matching" />
|
||||||
<field name="flag_nonmatching" />
|
<field name="flag_nonmatching" />
|
||||||
<field name="match_first" />
|
<field name="match_first" />
|
||||||
|
|
Loading…
Reference in New Issue