diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py index e647dfcf122..ca6500d9b2d 100644 --- a/addons/mail/models/mail_template.py +++ b/addons/mail/models/mail_template.py @@ -69,12 +69,22 @@ class MailTemplate(models.Model): help="Sidebar action to make this template available on records " "of the related document model") + # access + can_write = fields.Boolean(compute='_compute_can_write', + help='The current user can edit the template.') + # Overrides of mail.render.mixin @api.depends('model') def _compute_render_model(self): for template in self: template.render_model = template.model + @api.depends_context('uid') + def _compute_can_write(self): + writable_templates = self._filter_access_rules('write') + for template in self: + template.can_write = template in writable_templates + # ------------------------------------------------------------ # CRUD # ------------------------------------------------------------ diff --git a/addons/mail/static/src/scss/composer.scss b/addons/mail/static/src/scss/composer.scss index 33a61c521ba..a7fc3eb484b 100644 --- a/addons/mail/static/src/scss/composer.scss +++ b/addons/mail/static/src/scss/composer.scss @@ -175,3 +175,10 @@ background-color: rgba($white, 0.1); } } + +.o_mail_composer_form { + .oe-bordered-editor[name=body] .o_readonly { + border: 1px solid $o-gray-300; + padding: 4px; + } +} diff --git a/addons/mail/views/mail_template_views.xml b/addons/mail/views/mail_template_views.xml index ee814dba4d2..664d09697f7 100644 --- a/addons/mail/views/mail_template_views.xml +++ b/addons/mail/views/mail_template_views.xml @@ -53,7 +53,10 @@