[REM] mail: remove unnecessary methods from mail.thread
* one dead method; * one unnecessary method to inline; * one unnecessary wrapper;
This commit is contained in:
@@ -22,8 +22,7 @@ class MailController(http.Controller):
|
||||
|
||||
@classmethod
|
||||
def _redirect_to_messaging(cls):
|
||||
messaging_action = request.env['mail.thread']._get_inbox_action_xml_id()
|
||||
url = '/web#%s' % url_encode({'action': messaging_action})
|
||||
url = '/web#%s' % url_encode({'action': 'mail.mail_channel_action_client_chat'})
|
||||
return werkzeug.utils.redirect(url)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -554,13 +554,6 @@ class MailThread(models.AbstractModel):
|
||||
DocModel.check_access_rights(check_operation)
|
||||
DocModel.browse(res_ids).check_access_rule(check_operation)
|
||||
|
||||
@api.model
|
||||
def _get_inbox_action_xml_id(self):
|
||||
""" When redirecting towards the Inbox, choose which action xml_id has
|
||||
to be fetched. This method is meant to be inherited, at least in portal
|
||||
because portal users have a different Inbox action than classic users. """
|
||||
return 'mail.mail_channel_action_client_chat'
|
||||
|
||||
@api.model
|
||||
def _generate_notification_token(self, base_link, params):
|
||||
secret = self.env['ir.config_parameter'].sudo().get_param('database.secret')
|
||||
@@ -808,15 +801,6 @@ class MailThread(models.AbstractModel):
|
||||
# Mail gateway
|
||||
# ------------------------------------------------------
|
||||
|
||||
@api.model
|
||||
def message_capable_models(self):
|
||||
""" Used by the plugin addon, based for plugin_outlook and others. """
|
||||
ret_dict = {}
|
||||
for model_name, model in self.env.items():
|
||||
if hasattr(model, "message_process") and hasattr(model, "message_post"):
|
||||
ret_dict[model_name] = model._description
|
||||
return ret_dict
|
||||
|
||||
def _message_find_partners(self, message, header_fields=['From']):
|
||||
""" Find partners related to some header fields of the message.
|
||||
|
||||
@@ -1705,18 +1689,15 @@ class MailThread(models.AbstractModel):
|
||||
]).write({'author_id': partner_info['partner_id']})
|
||||
return result
|
||||
|
||||
def _message_preprocess_attachments(self, attachments, attachment_ids, attach_model, attach_res_id):
|
||||
def _message_post_process_attachments(self, attachments, attachment_ids, message_data):
|
||||
""" Preprocess attachments for mail_thread.message_post() or mail_mail.create().
|
||||
|
||||
:param list attachments: list of attachment tuples in the form ``(name,content)``,
|
||||
where content is NOT base64 encoded
|
||||
:param list attachment_ids: a list of attachment ids, not in tomany command form
|
||||
:param str attach_model: the model of the attachments parent record
|
||||
:param integer attach_res_id: the id of the attachments parent record
|
||||
:param dict message_data: model: the model of the attachments parent record,
|
||||
res_id: the id of the attachments parent record
|
||||
"""
|
||||
return self._message_post_process_attachments(attachments, attachment_ids, {'model': attach_model, 'res_id': attach_res_id})
|
||||
|
||||
def _message_post_process_attachments(self, attachments, attachment_ids, message_data):
|
||||
IrAttachment = self.env['ir.attachment']
|
||||
m2m_attachment_ids = []
|
||||
cid_mapping = {}
|
||||
|
||||
@@ -325,9 +325,11 @@ class MailComposer(models.TransientModel):
|
||||
for attach_id in mail_values.pop('attachment_ids'):
|
||||
new_attach_id = self.env['ir.attachment'].browse(attach_id).copy({'res_model': self._name, 'res_id': self.id})
|
||||
attachment_ids.append(new_attach_id.id)
|
||||
mail_values['attachment_ids'] = self.env['mail.thread']._message_preprocess_attachments(
|
||||
mail_values['attachment_ids'] = self.env['mail.thread']._message_post_process_attachments(
|
||||
mail_values.pop('attachments', []),
|
||||
attachment_ids, 'mail.message', 0)
|
||||
attachment_ids,
|
||||
{'model': 'mail.message', 'res_id': 0}
|
||||
)
|
||||
|
||||
results[res_id] = mail_values
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user