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