[FIX mail: decorator issue
A method was designed to work in multi, but used sometimes as model and sometimes as one.
This commit is contained in:
@@ -1328,7 +1328,7 @@ class MailThread(models.AbstractModel):
|
||||
obj._message_add_suggested_recipient(result, partner=obj.user_id.partner_id, reason=self._fields['user_id'].string)
|
||||
return result
|
||||
|
||||
@api.model
|
||||
@api.multi
|
||||
def _find_partner_from_emails(self, emails, res_model=None, res_id=None, check_followers=True):
|
||||
""" Utility method to find partners from email addresses. The rules are :
|
||||
1 - check in document (model | self, id) followers
|
||||
|
||||
@@ -775,7 +775,7 @@ class task(osv.osv):
|
||||
new_task = self.browse(cr, uid, res, context=context)
|
||||
if new_task.project_id and new_task.project_id.alias_name: # check left-part is not already an alias
|
||||
email_list = filter(lambda x: x.split('@')[0] != new_task.project_id.alias_name, email_list)
|
||||
partner_ids = filter(lambda x: x, self._find_partner_from_emails(cr, uid, email_list, check_followers=False))
|
||||
partner_ids = filter(lambda x: x, self._find_partner_from_emails(cr, uid, [], email_list, check_followers=False))
|
||||
self.message_subscribe(cr, uid, [res], partner_ids, context=context)
|
||||
return res
|
||||
|
||||
|
||||
@@ -173,7 +173,6 @@ class website_slides(http.Controller):
|
||||
right partner. Their comments are not published by default. Logged
|
||||
users can post as usual. """
|
||||
# TDE TODO :
|
||||
# - fix _find_partner_from_emails -> is an api.one + strange results + should work as public user
|
||||
# - subscribe partner instead of user writing the message ?
|
||||
# - public user -> cannot create mail.message ?
|
||||
if not post.get('comment'):
|
||||
@@ -187,7 +186,7 @@ class website_slides(http.Controller):
|
||||
# be investigated - using SUPERUSER_ID meanwhile
|
||||
contextual_slide = slide.sudo().with_context(mail_create_nosubcribe=True)
|
||||
# TDE FIXME: check in mail_thread, find partner from emails should maybe work as public user
|
||||
partner_id = slide.sudo()._find_partner_from_emails([post.get('email')])[0][0]
|
||||
partner_id = slide.sudo()._find_partner_from_emails([post.get('email')])[0]
|
||||
if partner_id:
|
||||
partner = request.env['res.partner'].sudo().browse(partner_id)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user