odoo/odoo#159443

Created by fw-bot
label
odoo-dev:saas-17.1-15.0-opw-3703987-channel_shant_get_completed_without_any_slides-pian-q_aH-fw
head
71b206ca8a58db7121452eb5bafda68c1710d2e5
target
saas-17.1
merged
1 month ago by Andrzej Pietrusiak (pian)
forward-port of
odoo/odoo#153178

[FW][FIX] website_slides: Stop sending completion mail on all slides removal

### [[FIX] website_slides: Stop sending completion mail on all slides removal](https://github.com/odoo/odoo/pull/153178/commits/f74fdbe8bb9a20d82caad5b78ec3292c34124fad)

Construct deciding on whetheres an attendee should receive 'complete'
mail, contains a condition which checks if the attendee has:
number_completed_slides >= number of all slides
This however falls into a corner case when there is no slides at all and
computation gets triggered (which got introduced with commit [1] ).

### [This Commit Change]
This commit introduces an additional check on the total number of slides in
a channel. Consequently, records without any slides in the related channel
will no longer send completion mail notification.

### [Reproduce]
- Install website_slides
- Create a new eLearning course with some content but do not publish it.
- Add attendees.
- Delete all the content.
- BUG: emails about finishing the course got sent (Settings/Technical/Emails)

### [Why this commit modifies existing test]
The test introduced with commit [2] checks if a specific template is used
in email generation, requiring email generation to occur as a prerequisite.
Originally (before [This Commit Change]), it relied on the default behavior
that considered an attendee a completer even without any published slides,
thus triggering an email. However, after this commit, with a course containing
zero published slides, completion cannot occur, and thus, no emails are sent.

For this reason slight alteration of the test setup is required allowing
for the emails to get sent and in effect the test to perform its role.

### [References]
[1] https://github.com/odoo/odoo/commit/3efa80847c4631febefc770b79bb786953a05b36
[2] https://github.com/odoo/odoo/commit/9a0231d5c3fa25f4ec63303cfc7eb8e2bc8ff9e1

opw-3703987

Forward-Port-Of: odoo/odoo#153178