summaryrefslogtreecommitdiff
path: root/addons/mail
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-08-09 15:06:31 +0200
committerChristophe Simonis <chs@odoo.com>2018-08-09 15:06:31 +0200
commit9cb97a8c2daec720a2ccb8220f07b04a8786876c (patch)
tree8875292477a40d9f5d134d743c811231960ce525 /addons/mail
parent33e7479865763e8c8255db7e057ef4703bef6093 (diff)
parent499af66727e46272efcd7f6785176097642cb096 (diff)
[MERGE] forward port branch saas-11.2 up to 499af66727e
Diffstat (limited to 'addons/mail')
-rw-r--r--addons/mail/models/mail_channel.py2
-rw-r--r--addons/mail/models/mail_template.py6
-rw-r--r--addons/mail/views/mail_template_views.xml7
3 files changed, 9 insertions, 6 deletions
diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py
index f93449fbe21..3584222035e 100644
--- a/addons/mail/models/mail_channel.py
+++ b/addons/mail/models/mail_channel.py
@@ -469,7 +469,7 @@ class Channel(models.Model):
'is_minimized': minimized
}
domain = [('partner_id', '=', self.env.user.partner_id.id), ('channel_id.uuid', '=', uuid)]
- channel_partners = self.env['mail.channel.partner'].search(domain)
+ channel_partners = self.env['mail.channel.partner'].search(domain, limit=1)
channel_partners.write(values)
self.env['bus.bus'].sendone((self._cr.dbname, 'res.partner', self.env.user.partner_id.id), channel_partners.channel_id.channel_info()[0])
diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py
index 55c0d1beba5..36f7fa3bbb9 100644
--- a/addons/mail/models/mail_template.py
+++ b/addons/mail/models/mail_template.py
@@ -253,17 +253,17 @@ class MailTemplate(models.Model):
def unlink_action(self):
for template in self:
if template.ref_ir_act_window:
- template.ref_ir_act_window.sudo().unlink()
+ template.ref_ir_act_window.unlink()
return True
@api.multi
def create_action(self):
- ActWindowSudo = self.env['ir.actions.act_window'].sudo()
+ ActWindow = self.env['ir.actions.act_window']
view = self.env.ref('mail.email_compose_message_wizard_form')
for template in self:
button_name = _('Send Mail (%s)') % template.name
- action = ActWindowSudo.create({
+ action = ActWindow.create({
'name': button_name,
'type': 'ir.actions.act_window',
'res_model': 'mail.compose.message',
diff --git a/addons/mail/views/mail_template_views.xml b/addons/mail/views/mail_template_views.xml
index 80f1058a4f2..81def4a35ae 100644
--- a/addons/mail/views/mail_template_views.xml
+++ b/addons/mail/views/mail_template_views.xml
@@ -9,7 +9,9 @@
<sheet>
<div class="oe_button_box" name="button_box">
<field name="ref_ir_act_window" invisible="1"/>
- <button class="oe_stat_button" name="create_action" type="object"
+ <button class="oe_stat_button"
+ groups="base.group_system"
+ name="create_action" type="object"
attrs="{'invisible':[('ref_ir_act_window','!=',False)]}" icon="fa-plus"
help="Display an option on related documents to open a composition wizard with this template">
<div class="o_field_widget o_stat_info">
@@ -17,7 +19,8 @@
<span class="o_stat_text">Context Action</span>
</div>
</button>
- <button name="unlink_action" type="object"
+ <button name="unlink_action" type="object"
+ groups="base.group_system"
class="oe_stat_button" icon="fa-minus"
attrs="{'invisible':[('ref_ir_act_window','=',False)]}"
help="Remove the contextual action to use this template on related documents" widget="statinfo">