odoo/odoo#153178

Created by Bugfix, Andrzej Pietrusiak (pian)
Merged at 99d360b055c7a1322260c13b4d1127597351000e

Statuses:

label
odoo-dev:15.0-opw-3703987-channel_shant_get_completed_without_any_slides-pian
head
7341adfb94de1e42c91a6c612d103188fdd17dab
merged
1 year ago by Bugfix, Andrzej Pietrusiak (pian)
odoo/odoo
17.0 #153178
saas-17.1 #159443
saas-17.2 #159451
18.0
saas-18.1
saas-18.2
saas-18.3
saas-18.4
master #159471

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

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

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] 3efa80847c4631febefc770b79bb786953a05b36
[2] 9a0231d5c3fa25f4ec63303cfc7eb8e2bc8ff9e1

opw-3703987