mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-22 20:12:04 -06:00
[FIX] fix email import for V7
This commit is contained in:
parent
4af45fce4e
commit
4e67654e3b
@ -3,17 +3,14 @@
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="view_email_server_form">
|
||||
<field name="name">fetchmail.server.form</field>
|
||||
<field name="model">fetchmail.server</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="fetchmail.view_email_server_form"/>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
<field name="date" position="after">
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
</field>
|
||||
<field name="object_id" position="after">
|
||||
<field name="file_type"/> <!-- TODO attrs="{'invisible': [('object_id','!=', 'file.document')]}"/>-->
|
||||
<field name="file_type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -35,6 +35,39 @@ class file_document(orm.Model):
|
||||
'The combination of Email Server and External id must be unique !'),
|
||||
]
|
||||
|
||||
|
||||
def message_process(self, cr, uid, model, message, custom_values=None,
|
||||
save_original=False, strip_attachments=False,
|
||||
thread_id=None, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
context['no_post'] = True
|
||||
return super(file_document, self).message_process(self, cr, uid, model,
|
||||
message,
|
||||
custom_values=custom_values,
|
||||
save_original=save_original,
|
||||
strip_attachments=strip_attachments,
|
||||
thread_id=thread_id,
|
||||
context=context)
|
||||
|
||||
def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification',
|
||||
subtype=None, parent_id=False, attachments=None, context=None,
|
||||
content_subtype='html', **kwargs):
|
||||
if context.get('no_post'):
|
||||
return None
|
||||
return super(file_document, self).message_post(cr, uid, thread_id,
|
||||
body=body,
|
||||
subject=subject,
|
||||
type='notification',
|
||||
subtype=subtype,
|
||||
parent_id=parent_id,
|
||||
attachments=attachments,
|
||||
context=context,
|
||||
content_subtype=content_subtype,
|
||||
**kwargs)
|
||||
|
||||
|
||||
|
||||
def _prepare_data_for_file_document(self, cr, uid, msg, context=None):
|
||||
"""Method to prepare the data for creating a file document.
|
||||
:param msg: a dictionnary with the email data
|
||||
@ -56,5 +89,8 @@ class file_document(orm.Model):
|
||||
if not key in vals:
|
||||
vals[key] = default[key]
|
||||
created_ids.append(self.create(cr, uid, vals, context=context))
|
||||
return created_ids
|
||||
cr.commit()
|
||||
context['created_ids'] = created_ids
|
||||
return created_ids[0]
|
||||
return None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user