[FIX] website_sale_slides: prevent payment screen crash on pending transactions

Issue: When a course is set to 'On Payment' and
linked to our 'Course Access' product, users
encounter an issue where they cannot view the
final screen of the payment process when selecting
payment methods like 'wire transfer'. This occurs
because the payment status remains 'pending', and
the user has not yet been granted access to the
course, meaning no invitation link is available.

Steps to Reproduce:

1. Install website_sale_slides.
2. Create or modify a course with the 'On Payment'
status.
3. Link it to a 'Course Access' product.
4. Navigate to the website and attempt to purchase
the course.
5. Proceed through all the steps of the payment
process.

Solution: The template needs to accommodate
scenarios where certain payment methods do not
immediately provide an invitation link.
Even without the invitation link, it should still
display the last payment screen, awaiting payment
confirmation to grant access.

opw-3683024

closes odoo/odoo#161618

X-original-commit: eee6222763b4d88f75994b498d15cd4358899fc1
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
Signed-off-by: Maruan Aguerdouh Mohtar (magm) <magm@odoo.com>
This commit is contained in:
Maruan Aguerdouh (magm)
2024-04-12 12:56:40 +00:00
parent 2fd2964a31
commit fc42effbdf
@@ -21,7 +21,7 @@
<span t-if="course.image_1920" t-field="course.image_1920" t-options="{'widget': 'image', 'class': 'my-2'}"/>
<img t-else="" class="img img-fluid my-2" src="/website_slides/static/src/img/channel-training-default.jpg"/>
</div>
<t t-set="invitation_link" t-value="course_memberships[course].invitation_link"/>
<t t-set="invitation_link" t-value="course_memberships[course].invitation_link if course in course_memberships else ''"/>
<div class="col-7">
<a t-att-href="invitation_link"><h3 t-out="course.name" class="m-2"/></a>
<div t-out="course.description_short" class="fw-light o_wslides_desc_truncate_2 ms-2"/>
@@ -31,7 +31,7 @@
<t t-if="course.total_time"> - </t><t t-out="course.total_slides"/> step(s)
</t>
</div>
<a role="button" class="btn btn-primary ms-2 my-2" t-att-href="invitation_link">
<a role="button" class="btn btn-primary ms-2 my-2" t-attf-class="btn btn-primary ms-2 my-2 #{'disabled' if not invitation_link else ''}" t-att-href="invitation_link">
Start Learning
</a>
</div>