fix11
This commit is contained in:
parent
7ce02108cc
commit
2d139e6bba
|
|
@ -221,27 +221,25 @@ class ServerActions(models.Model):
|
|||
return super()._run_action_email(eval_context=eval_context)
|
||||
class MailActivity(models.Model):
|
||||
_inherit = 'mail.activity'
|
||||
|
||||
def action_notify(self):
|
||||
if not self:
|
||||
return
|
||||
original_context = self.env.context
|
||||
body_template = self.env.ref('mail.message_activity_assigned')
|
||||
|
||||
for activity in self:
|
||||
if activity.user_id.lang:
|
||||
self = self.with_context(lang=activity.user_id.lang)
|
||||
body_template = body_template.with_context(lang=activity.user_id.lang)
|
||||
activity = activity.with_context(lang=activity.user_id.lang)
|
||||
model_description = self.env['ir.model']._get(activity.res_model).display_name
|
||||
body = body_template._render(
|
||||
lang = activity.user_id.lang or self.env.user.lang
|
||||
model_description = self.env['ir.model'].with_context(lang=lang)._get(activity.res_model).display_name
|
||||
|
||||
body = self.env['ir.qweb'].with_context(lang=lang)._render(
|
||||
'mail.message_activity_assigned',
|
||||
{
|
||||
'activity': activity,
|
||||
'model_description': model_description,
|
||||
'access_link': self.env['mail.thread']._notify_get_action_link('view', model=activity.res_model,
|
||||
res_id=activity.res_id),
|
||||
'access_link': self.env['mail.thread']._notify_get_action_link('view', model=activity.res_model, res_id=activity.res_id),
|
||||
},
|
||||
engine='ir.qweb',
|
||||
minimal_qcontext=True
|
||||
)
|
||||
|
||||
record = self.env[activity.res_model].browse(activity.res_id)
|
||||
if activity.user_id:
|
||||
record.message_post(
|
||||
|
|
@ -253,8 +251,8 @@ class MailActivity(models.Model):
|
|||
email_layout_xmlid='system_notification.mail_notification_odex',
|
||||
message_type='notification'
|
||||
)
|
||||
body_template = body_template.with_context(original_context)
|
||||
self = self.with_context(original_context)
|
||||
|
||||
|
||||
class BaseGroupAutomation(models.Model):
|
||||
_name = 'automation.group'
|
||||
_rec_name = 'model_id'
|
||||
|
|
|
|||
Loading…
Reference in New Issue