puts profile on email condition instead of fetchmail server

This commit is contained in:
florian-dacosta 2014-12-15 10:33:58 +01:00
parent 95274049ce
commit 01a9e55a3b

View File

@ -63,21 +63,24 @@ class file_document(orm.Model):
content_subtype=content_subtype, content_subtype=content_subtype,
**kwargs) **kwargs)
def _get_file_document_data(self, cr, uid, condition, msg, att, context=None):
values = {
'file_type': condition.server_id.file_type,
'name': msg['subject'],
'direction': 'input',
'date': msg['date'],
'ext_id': msg['message_id'],
'datas_fname': att[0],
'datas': base64.b64encode(att[1])
}
return values
def prepare_data_from_basic_condition(self, cr, uid, condition, msg, context=None): def prepare_data_from_basic_condition(self, cr, uid, condition, msg, context=None):
vals = {} vals = {}
if condition.from_email in msg['from'] and condition.mail_subject in msg['subject']: if condition.from_email in msg['from'] and condition.mail_subject in msg['subject']:
for att in msg['attachments']: for att in msg['attachments']:
if condition.file_extension in att[0]: if condition.file_extension in att[0]:
vals = { vals = self._get_file_document_data(cr, uid, condition, msg, att, context=context)
'file_type': condition.server_id.file_type,
'name': msg['subject'],
'direction': 'input',
'date': msg['date'],
'ext_id': msg['message_id'],
'datas_fname': att[0],
'datas': base64.b64encode(att[1])
}
break break
return vals return vals