|
@ -21,7 +21,10 @@ class AttachMailManually(models.TransientModel): |
|
|
def default_get(self, fields_list): |
|
|
def default_get(self, fields_list): |
|
|
defaults = super(AttachMailManually, self).default_get(fields_list) |
|
|
defaults = super(AttachMailManually, self).default_get(fields_list) |
|
|
defaults['mail_ids'] = [] |
|
|
defaults['mail_ids'] = [] |
|
|
folder = self.env.context.get('folder') |
|
|
|
|
|
|
|
|
folder_model = self.env['fetchmail.server.folder'] |
|
|
|
|
|
folder_id = self.env.context.get('folder_id') |
|
|
|
|
|
defaults['folder_id'] = folder_id |
|
|
|
|
|
folder = folder_model.browse([folder_id]) |
|
|
connection = folder.server_id.connect() |
|
|
connection = folder.server_id.connect() |
|
|
connection.select(folder.path) |
|
|
connection.select(folder.path) |
|
|
criteria = 'FLAGGED' if folder.flag_nonmatching else 'UNDELETED' |
|
|
criteria = 'FLAGGED' if folder.flag_nonmatching else 'UNDELETED' |
|
@ -62,8 +65,10 @@ class AttachMailManually(models.TransientModel): |
|
|
result = super(AttachMailManually, self).fields_view_get( |
|
|
result = super(AttachMailManually, self).fields_view_get( |
|
|
view_id=view_id, view_type=view_type, toolbar=toolbar, |
|
|
view_id=view_id, view_type=view_type, toolbar=toolbar, |
|
|
submenu=submenu) |
|
|
submenu=submenu) |
|
|
|
|
|
folder_model = self.env['fetchmail.server.folder'] |
|
|
|
|
|
folder_id = self.env.context.get('folder_id') |
|
|
|
|
|
folder = folder_model.browse([folder_id]) |
|
|
tree = result['fields']['mail_ids']['views']['tree'] |
|
|
tree = result['fields']['mail_ids']['views']['tree'] |
|
|
folder = self.env.context.get('folder') |
|
|
|
|
|
tree['fields']['object_id']['selection'] = [ |
|
|
tree['fields']['object_id']['selection'] = [ |
|
|
(folder.model_id.model, folder.model_id.name)] |
|
|
(folder.model_id.model, folder.model_id.name)] |
|
|
return result |
|
|
return result |
|
|