Skip to content

[19.0][MIG] website_sale_slides_survey_multi_qty: Migration to version 19.0 - #28

Open
pilarvargas-tecnativa wants to merge 4 commits into
OCA:19.0from
Tecnativa:19.0-mig-website_sale_slides_survey_multi_qty
Open

[19.0][MIG] website_sale_slides_survey_multi_qty: Migration to version 19.0#28
pilarvargas-tecnativa wants to merge 4 commits into
OCA:19.0from
Tecnativa:19.0-mig-website_sale_slides_survey_multi_qty

Conversation

@pilarvargas-tecnativa

@pilarvargas-tecnativa pilarvargas-tecnativa commented Sep 11, 2026

Copy link
Copy Markdown

@OCA-git-bot OCA-git-bot added series:19.0 mod:website_sale_slides_survey_multi_qty Module website_sale_slides_survey_multi_qty labels Sep 11, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code reviewed and tested locally

expr="//div[a[contains(@t-att-href, '/survey/%s/get_certification')]]"
position="attributes"
>
<attribute name="t-if">not website.is_public_user()</attribute>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<attribute name="t-if">not website.is_public_user()</attribute>
<attribute name="t-if">survey.certification and not website.is_public_user()</attribute>
Image Image

position="attributes" here replaces the existing t-if="survey.certification" instead of extending it, so the "Download certification" button ends up showing for any passed scored survey, not just certifications. Should be t-if="survey.certification and not website.is_public_user()" to keep the original guard.

<templates>
<t
t-name="website.slides.fullscreen.certification"
t-inherit="website_slides_survey.website.slides.fullscreen.certification"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t-inherit="website_slides_survey.website.slides.fullscreen.certification"
t-inherit="website.slides.fullscreen.certification"
Image

t-inherit references a template name that doesn't exist (website_slides_survey.website.slides.fullscreen.certification) — the base template registers as website.slides.fullscreen.certification (no module prefix). As a result the whole extension silently fails to apply (console: Missing (extension) parent templates: ...), so the d-none never takes effect and the "Download certification" button stays visible.

Comment on lines +16 to +21
def slide_get_certification_url(self, slide_id, **kw):
slide = request.env["slide.slide"].browse(int(slide_id))
res = super().slide_get_certification_url(slide_id=slide_id, **kw)
if request.env.user._is_public() and not slide.channel_id._has_key_session():
return request.redirect("/web/login")
return res

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def slide_get_certification_url(self, slide_id, **kw):
slide = request.env["slide.slide"].browse(int(slide_id))
res = super().slide_get_certification_url(slide_id=slide_id, **kw)
if request.env.user._is_public() and not slide.channel_id._has_key_session():
return request.redirect("/web/login")
return res
def slide_get_certification_url(self, slide_id, **kw):
slide = request.env["slide.slide"].sudo().browse(int(slide_id))
if request.env.user._is_public() and not slide.channel_id._has_key_session():
return request.redirect("/web/login")
return super().slide_get_certification_url(slide_id=slide_id, **kw)
Image

The redirect-to-login check for a public user without a valid key session runs after calling super(), which already fetched the slide, marked it viewed and called _generate_certification_url() (a DB write). Before this PR (auth='user'), an anonymous visitor never reached this code at all; now they do, and the extra un-sudo'd browse() blows up with an AccessError (403) instead of a clean redirect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:website_sale_slides_survey_multi_qty Module website_sale_slides_survey_multi_qty series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants