[FIX] survey: test if survey exist in survey_layout for background management

Since fd75481d52, we use the survey variable to compute the
background_image_url in the survey_layout. In some cases (notably in
survey_session_code template), this layout is used without knowing the
variable 'survey'.

After this commit, the 'survey' variable is tested before usage.

Also, this commit add the o_survey_background class to the t-attf-class that
already exists on 'wrapwrap' selector. Otherwise, by having both t-att-class
and t-attf-class, only the t-att-class is kept.

Task-2703147

closes odoo/odoo#80656

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
David Beguin
2021-12-01 10:18:11 +00:00
parent 1ceccf68e8
commit 51d131663c
+2 -2
View File
@@ -14,9 +14,9 @@
else ('background-image: url(' + page.background_image_url + ');')
if page and page.background_image_url
else ('background-image: url(' + survey.background_image_url + ');')
if survey.background_image_url
if survey and survey.background_image_url
else '')"/>
<attribute name="t-att-class" add="'o_survey_background'"/>
<attribute name="t-attf-class" add="o_survey_background" separator=" "/>
</xpath>
<xpath expr="//head/t[@t-call-assets][last()]" position="after">
<t t-call-assets="survey.survey_assets" lazy_load="True"/>