[FIX] website_slides: changes enroll_msg default value

SPECIFICATION

Changes enroll_msg default value to 'Contact Responsible' instead
of testing if it was empty or not. Since the FieldHtml widget sets
the default value to '<p><br></p>' it was never empty.

LINKS

Task ID : 2127364
PR : #40708
This commit is contained in:
Patrick Hoste
2020-06-08 07:14:14 +00:00
committed by Thibault Delavallée
parent 2aa150e195
commit ad8c53ac2c
2 changed files with 5 additions and 3 deletions
@@ -85,6 +85,9 @@ class Channel(models.Model):
def _default_access_token(self):
return str(uuid.uuid4())
def _get_default_enroll_msg(self):
return _('Contact Responsible')
# description
name = fields.Char('Name', translate=True, required=True)
active = fields.Boolean(default=True, tracking=100)
@@ -145,7 +148,7 @@ class Channel(models.Model):
help='Condition to enroll: everyone, on invite, on payment (sale bridge).')
enroll_msg = fields.Html(
'Enroll Message', help="Message explaining the enroll process",
default=False, translate=tools.html_translate, sanitize_attributes=False)
default=_get_default_enroll_msg, translate=tools.html_translate, sanitize_attributes=False)
enroll_group_ids = fields.Many2many('res.groups', string='Auto Enroll Groups', help="Members of those groups are automatically added as members of the channel.")
visibility = fields.Selection([
('public', 'Public'), ('members', 'Members Only')],
@@ -296,8 +296,7 @@
</a>
<div t-if="not channel.is_member and channel.enroll == 'invite'" class="text-center">
<div class="alert my-0 bg-100 p-2">Private Course</div>
<div t-if="channel.enroll_msg" t-field="channel.enroll_msg"/>
<small t-if="not channel.enroll_msg">Contact website administrator.</small>
<div class="o_wslides_enroll_msg mt-2" t-field="channel.enroll_msg"/>
</div>
<t t-if="channel.is_member">
<button class="d-flex align-items-center alert my-0 px-2 px-xl-3 bg-100 w-100 o_wslides_js_channel_unsubscribe"