[REVIEW] base_stage: removed now dead message_thread_followers method. mail_thread: set message_capable_models back, because it is used in the plugin addon, adn therefore in various plugin_XXX addons. Maybe a refactoring of those plugins could be done, but it is beyond the scope of this refactoring.

bzr revid: tde@openerp.com-20120904145011-tlwgcu32uv8cwe6g
This commit is contained in:
Thibault Delavallée 2012-09-04 16:50:11 +02:00
parent fd2a413969
commit bacbb8e2f4
2 changed files with 12 additions and 17 deletions

View File

@ -360,17 +360,6 @@ class base_stage(object):
def format_mail(self, obj, body):
return self.pool.get('base.action.rule').format_mail(obj, body)
def message_thread_followers(self, cr, uid, ids, context=None):
res = {}
for case in self.browse(cr, uid, ids, context=context):
l=[]
if case.email_cc:
l.append(case.email_cc)
if case.user_id and case.user_id.email:
l.append(case.user_id.email)
res[case.id] = l
return res
# ******************************
# Notifications
# ******************************

View File

@ -211,6 +211,15 @@ class mail_thread(osv.AbstractModel):
# Mail gateway
#------------------------------------------------------
def message_capable_models(self, cr, uid, context=None):
""" Used by the plugin addon, based for plugin_outlook and others. """
ret_dict = {}
for model_name in self.pool.obj_list():
model = self.pool.get(model_name)
if 'mail.thread' in getattr(model, '_inherit', []):
ret_dict[model_name] = model._description
return ret_dict
def _message_find_partners(self, cr, uid, message, header_fields=['From'], context=None):
""" Find partners related to some header fields of the message. """
s = ', '.join([decode(message.get(h)) for h in header_fields if message.get(h)])
@ -378,9 +387,7 @@ class mail_thread(osv.AbstractModel):
for a given thread model, if the message did not belong to
an existing thread.
The default behavior is to create a new record of the corresponding
model (based on some very basic info extracted from the message),
then attach the message to the newly created record
(by calling ``message_append_dict``).
model (based on some very basic info extracted from the message).
Additional behavior may be implemented by overriding this method.
:param dict msg_dict: a map containing the email details and
@ -413,9 +420,8 @@ class mail_thread(osv.AbstractModel):
def message_update(self, cr, uid, ids, msg_dict, update_vals=None, context=None):
"""Called by ``message_process`` when a new message is received
for an existing thread. The default behavior is to create a
new mail.message in the given thread (by calling
``message_append_dict``)
for an existing thread. The default behavior is to update the record
with update_vals taken from the incoming email.
Additional behavior may be implemented by overriding this
method.
:param dict msg_dict: a map containing the email details and