[IMP] website, website_sale: remove most escaping from Dynamic Products

Before this commit the filtering code for the Dynamic Products snippet
was rendering all its values.

After this commit the filtering code for the Dynamic Products snippet
mostly returns the values to be rendered.
Because the list_price still needs to be rendered with the correct
currency, the general rendering mechanism is being informed through the
field meta-data that the escaping was already done.

task-2446024
https://github.com/odoo/odoo/pull/65176
This commit is contained in:
Benoit Socias
2021-02-16 10:18:15 +00:00
parent df7c77fd7a
commit 1d2dd3f76f
3 changed files with 75 additions and 58 deletions
+7 -5
View File
@@ -723,10 +723,11 @@
</record>
<!-- Template for Dynamic Snippet -->
<template id="dynamic_filter_template_image_title_footer" name="Image Title Footer Card">
<t t-foreach="records" t-as="record">
<t t-foreach="to_generic(records)" t-as="record">
<t t-set="fields" t-value="list(record['fields'].values())"/>
<t t-set="fieldsImg" t-value="list(record['image_fields'].values())"/>
<div class="card h-100" t-att-data-url="record['fields']['call_to_action_url']">
<t t-set="call_to_action_url" t-value="record['call_to_action_url']"/>
<div class="card h-100" t-att-data-url="call_to_action_url">
<h4 t-if="is_sample" class="o_ribbon_right bg-warning text-uppercase">Sample</h4>
<img t-if="len(fieldsImg) > 0" class="card-img-top p-3" loading="lazy" t-att-src="fieldsImg[0]"/>
<div class="card-body">
@@ -741,7 +742,7 @@
<div t-if="len(fields) > 2" class="card-text">
<t t-raw="fields[2]"/>
</div>
<a t-if="call_to_action" class="btn btn-primary ml-auto" t-att-href="record['fields']['call_to_action_url']">
<a t-if="call_to_action" class="btn btn-primary ml-auto" t-att-href="call_to_action_url">
<i class="fa fa-fw fa-eye"/>
</a>
</div>
@@ -749,10 +750,11 @@
</t>
</template>
<template id="dynamic_filter_template_header_image_footer_card" name="Header Image Footer Card">
<t t-foreach="records" t-as="record">
<t t-foreach="to_generic(records)" t-as="record">
<t t-set="fields" t-value="list(record['fields'].values())"/>
<t t-set="fieldsImg" t-value="list(record['image_fields'].values())"/>
<div class="card h-100" t-att-data-url="record['fields']['call_to_action_url']">
<t t-set="call_to_action_url" t-value="record['call_to_action_url']"/>
<div class="card h-100" t-att-data-url="call_to_action_url">
<h4 t-if="is_sample" class="o_ribbon_right bg-warning text-uppercase">Sample</h4>
<h5 t-if="len(fields) > 0" class="card-header">
<t t-raw="fields[0]"/>