[IMP] website_sale, *: adapt customize show options in shop pages

*: website, website_sale_comparison, website_sale_loyalty,
   website_sale_slides, website_sale_wishlist

This commit adapts "customize show" options from website sale modules by
creating new options available in edit mode.

See merge commit for more information.

task-2710582
This commit is contained in:
Benjamin Vray
2022-06-24 10:28:05 +02:00
committed by qsm-odoo
parent 9b1f4a84e3
commit 17a8a37e9b
18 changed files with 243 additions and 68 deletions
-7
View File
@@ -606,13 +606,6 @@ class Website(Home):
views = views.sorted(key=lambda v: (v.inherit_id.id, v.name))
return views.with_context(display_website=False).read(['name', 'id', 'key', 'xml_id', 'active', 'inherit_id'])
@http.route('/website/toggle_switchable_view', type='json', auth='user', website=True)
def toggle_switchable_view(self, view_key):
if request.website.user_has_groups('website.group_website_designer'):
request.website.viewref(view_key).toggle_active()
else:
return werkzeug.exceptions.Forbidden()
@http.route('/website/reset_template', type='http', auth='user', methods=['POST'], website=True, csrf=False)
def reset_template(self, view_id, mode='soft', redirect='/', **kwargs):
""" This method will try to reset a broken view.
+3 -3
View File
@@ -141,9 +141,9 @@ class Website(main.Website):
return views
@http.route()
def toggle_switchable_view(self, view_key):
super(Website, self).toggle_switchable_view(view_key)
if view_key in ('website_sale.products_list_view', 'website_sale.add_grid_or_list_option'):
def theme_customize_data(self, is_view_data, enable=None, disable=None, reset_view_arch=False):
super().theme_customize_data(is_view_data, enable, disable, reset_view_arch)
if any(key in enable or key in disable for key in ['website_sale.products_list_view', 'website_sale.add_grid_or_list_option']):
request.session.pop('website_sale_shop_layout_mode', None)
@http.route()
@@ -36,8 +36,8 @@ class ProductTemplate(models.Model):
public_categ_ids = fields.Many2many(
'product.public.category', relation='product_public_category_product_template_rel',
string='Website Product Category',
help="The product will be available in each mentioned eCommerce category. Go to Shop > "
"Customize and enable 'eCommerce categories' to view all eCommerce categories.")
help="The product will be available in each mentioned eCommerce category. Go to Shop > Edit "
"Click on the page and enable 'Categories' to view all eCommerce categories.")
product_template_image_ids = fields.One2many('product.image', 'product_tmpl_id', string="Extra Product Media", copy=True)
@@ -296,6 +296,19 @@ options.registry.WebsiteSaleGridLayout = options.Class.extend({
}).then(reload);
},
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
/**
* @override
*/
async updateUIVisibility() {
await this._super(...arguments);
const pprSelector = this.el.querySelector('.o_wsale_ppr_submenu.d-none');
this.el.querySelector('.o_wsale_ppr_by').classList.toggle('d-none', pprSelector);
},
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
@@ -9,8 +9,8 @@
td {
margin: 0;
padding: 0;
width: 40px;
height: 40px;
width: 20px;
height: 20px;
border: 1px #dddddd solid;
cursor: pointer;
+125 -19
View File
@@ -9,21 +9,23 @@
<template id="snippet_options" inherit_id="website.snippet_options" name="e-commerce snippet options">
<xpath expr="." position="inside">
<div data-js="WebsiteSaleGridLayout"
data-selector="#products_grid .o_wsale_products_grid_table_wrapper > table"
data-no-check="true">
<we-input string="Number of products" data-set-ppg="" data-no-preview="true"/>
<we-select string="Number of Columns" class="o_wsale_ppr_submenu" data-no-preview="true">
<we-button data-set-ppr="2">2</we-button>
<we-button data-set-ppr="3">3</we-button>
<we-button data-set-ppr="4">4</we-button>
<!-- All products page -->
<div data-js="WebsiteSaleGridLayout" data-page-options="true" data-selector="main:has(.o_wsale_products_page)" data-no-check="true"
string="Products Page" data-target="#products_grid .o_wsale_products_grid_table_wrapper > table">
<we-select string="Layout" data-no-preview="true" data-reload="/">
<we-button data-customize-website-views="" data-name="grid_view_opt">Grid</we-button>
<we-button data-customize-website-views="website_sale.products_list_view">List</we-button>
</we-select>
<we-select string="Default Sort" class="o_wsale_sort_submenu" data-no-preview="true">
<t t-foreach="request.env['website']._get_product_sort_mapping()" t-as="query_and_label">
<we-button t-att-data-set-default-sort="query_and_label[0]"><t t-esc="query_and_label[1]"/></we-button>
</t>
</we-select>
<we-select string="Design">
<we-row string="⌙ Size">
<we-input data-set-ppg="" data-no-preview="true" data-reload="/"/>
<span class="mx-2 o_wsale_ppr_by">by</span>
<we-select class="o_wsale_ppr_submenu" data-dependencies="grid_view_opt" data-no-preview="true" data-reload="/">
<we-button data-set-ppr="2">2</we-button>
<we-button data-set-ppr="3">3</we-button>
<we-button data-set-ppr="4">4</we-button>
</we-select>
</we-row>
<we-select string="⌙ Style">
<we-button data-select-class=""
data-customize-website-views="">
Default
@@ -41,7 +43,7 @@
Grid
</we-button>
</we-select>
<we-select string="Images Height">
<we-select string="⌙ Images Size">
<we-button data-select-class="o_wsale_context_thumb_4_3"
data-customize-website-views="website_sale.products_thumb_4_3">
Landscape (4/3)
@@ -71,8 +73,55 @@
data-customize-website-views="website_sale.products_thumb_cover">
</we-button>
</we-button-group>
<we-checkbox string="Prod. Desc."
data-customize-website-views="website_sale.products_description"
data-no-preview="true"
data-reload="/"/>
<we-row string="Left Panel" class="o_we_full_row">
<we-button string="Categories"
data-name="categories_opt"
data-customize-website-views="website_sale.products_categories"
data-no-preview="true"
data-reload="/"/>
<we-button string="Attributes"
data-name="attributes_opt"
data-customize-website-views="website_sale.products_attributes"
data-no-preview="true"
data-reload="/"/>
</we-row>
<we-checkbox string="⌙ Collapse Category Recursive"
data-customize-website-views="website_sale.option_collapse_products_categories"
data-dependencies="categories_opt"
data-no-preview="true"
data-reload="/"/>
<we-checkbox string="⌙ Price Filter"
data-customize-website-views="website_sale.filter_products_price"
data-dependencies="categories_opt, attributes_opt"
data-no-preview="true"
data-reload="/"/>
<we-row string="Top Bar" class="o_we_full_row">
<we-button string="Sort by"
data-customize-website-views="website_sale.sort"
data-no-preview="true"
data-reload="/"/>
<we-button string="Layout"
data-customize-website-views="website_sale.add_grid_or_list_option"
data-no-preview="true"
data-reload="/"/>
</we-row>
<we-select string="Default Sort" class="o_wsale_sort_submenu" data-no-preview="true">
<t t-foreach="request.env['website']._get_product_sort_mapping()" t-as="query_and_label">
<we-button t-att-data-set-default-sort="query_and_label[0]"><t t-esc="query_and_label[1]"/></we-button>
</t>
</we-select>
<we-row string="Buttons" class="o_we_full_row">
<we-button title="Add to Cart" class="fa fa-fw fa-shopping-cart o_we_add_to_cart_btn"
data-customize-website-views="website_sale.products_add_to_cart"
data-no-preview="true"
data-reload="/"/>
</we-row>
</div>
<!-- Product -->
<div data-js="WebsiteSaleProductsItem"
data-selector="#products_grid .oe_product"
data-no-check="true">
@@ -131,11 +180,17 @@
data-no-check="true"
groups="website.group_website_designer">
<we-checkbox string="Show Empty Cart"
data-customize-website-views="website_sale.header_hide_empty_cart_link|"
data-no-preview="true"
data-reload="/"/>
data-customize-website-views="website_sale.header_hide_empty_cart_link|"
data-no-preview="true"
data-reload="/"/>
</div>
<!-- Product image -->
<div data-selector="#product_detail #o-carousel-product" data-no-check="true">
<we-select string="Image Zoom" data-no-preview="true" data-reload="/">
<we-button data-customize-website-views="">None</we-button>
<we-button data-customize-website-views="website_sale.product_picture_magnify">On click</we-button>
<we-button data-customize-website-views="website_sale.product_picture_magnify_auto">On hover</we-button>
</we-select>
<we-button-group string="Thumbnails Position" data-no-preview="true" data-reload="/">
<we-button class="fa fa-fw fa-long-arrow-left" title="Left" data-customize-website-views="website_sale.carousel_product_indicators_left"/>
<we-button class="fa fa-fw fa-long-arrow-down" title="Bottom" data-customize-website-views="website_sale.carousel_product_indicators_bottom"/>
@@ -149,6 +204,57 @@
<we-button data-set-display-type="color">Color</we-button>
</we-select>
</div>
<!-- Product page -->
<div data-selector="main:has(.o_wsale_product_page)" data-page-options="true" data-no-check="true" string="Product Page">
<we-row string="Customers" class="o_we_full_row">
<we-button string="Rating"
data-customize-website-views="website_sale.product_comment"
data-no-preview="true"
data-reload="/"/>
<we-button string="Share"
data-name="attributes_opt"
data-customize-website-views="website_sale.product_share_buttons"
data-no-preview="true"
data-reload="/"/>
</we-row>
<we-checkbox string="Select Quantity"
data-customize-website-views="website_sale.product_quantity"
data-no-preview="true"
data-reload="/"/>
<we-select string="Variants" data-no-preview="true" data-reload="/">
<we-button data-customize-website-views="">Options</we-button>
<we-button data-customize-website-views="website_sale.product_variants">Products List</we-button>
</we-select>
<we-row string="Cart" class="o_we_full_row">
<we-button title="Buy Now" class="fa fa-fw fa-bolt o_we_buy_now_btn"
data-customize-website-views="website_sale.product_buy_now"
data-no-preview="true"
data-reload="/"/>
</we-row>
</div>
<!-- Checkout page -->
<div data-selector="main:has(.oe_website_sale .wizard)" data-page-options="true" data-no-check="true" string="Checkout Pages">
<we-checkbox string="Extra Step Option"
data-customize-website-views="website_sale.extra_info_option"
data-no-preview="true"
data-reload="/"/>
<we-checkbox string="Suggested Accessories"
data-customize-website-views="website_sale.suggested_products_list"
data-no-preview="true"
data-reload="/"/>
<we-checkbox string="Promo Code"
data-customize-website-views="website_sale.reduction_code"
data-no-preview="true"
data-reload="/"/>
<we-checkbox string="Accept Terms &amp; Conditions"
data-customize-website-views="website_sale.payment_sale_note"
data-no-preview="true"
data-reload="/"/>
<we-checkbox string="Show b2b Fields"
data-customize-website-views="website_sale.address_b2b"
data-no-preview="true"
data-reload="/"/>
</div>
</xpath>
</template>
+26 -29
View File
@@ -203,7 +203,7 @@
</form>
</template>
<template id="products_description" inherit_id="website_sale.products_item" active="False" customize_show="True" name="Product Description">
<template id="products_description" inherit_id="website_sale.products_item" active="False" name="Product Description">
<xpath expr="//*[hasclass('o_wsale_products_item_title')]" position="after">
<div class="oe_subdescription mb-2 text-muted small" contenteditable="false">
<div itemprop="description" t-field="product.description_sale"/>
@@ -211,7 +211,7 @@
</xpath>
</template>
<template id="products_add_to_cart" inherit_id="website_sale.products_item" active="False" customize_show="True" name="Add to Cart">
<template id="products_add_to_cart" inherit_id="website_sale.products_item" active="False" name="Add to Cart">
<xpath expr="//div[hasclass('o_wsale_product_btn')]" position="inside">
<t t-set="product_variant_id" t-value="product._get_first_possible_variant_id()"/>
<input name="product_id" t-att-value="product_variant_id" type="hidden"/>
@@ -263,7 +263,7 @@
<t t-set="additional_title">Shop</t>
<t t-set="grid_block_name">Grid</t>
<t t-set="product_block_name">Product</t>
<div id="wrap" class="js_sale">
<div id="wrap" class="js_sale o_wsale_products_page">
<div class="oe_structure oe_empty oe_structure_not_nearest" id="oe_structure_website_sale_products_1"/>
<div class="container oe_website_sale pt-2">
<div class="row o_wsale_products_main_row">
@@ -383,7 +383,7 @@
</xpath>
</template>
<template id="sort" inherit_id="website_sale.products" customize_show="True" name="Show Sort by">
<template id="sort" inherit_id="website_sale.products" name="Show Sort by">
<xpath expr="//div[hasclass('products_header')]/t[@t-call='website_sale.pricelist_list']" position="after">
<t t-set="website_sale_sortable" t-value="website._get_product_sort_mapping()"/>
<t t-set="website_sale_sortable_current" t-value="[sort for sort in website_sale_sortable if sort[0]==request.params.get('order', '')]"/>
@@ -411,7 +411,7 @@
</xpath>
</template>
<template id="add_grid_or_list_option" inherit_id="website_sale.products" active="True" customize_show="True" name="Grid or List button">
<template id="add_grid_or_list_option" inherit_id="website_sale.products" active="True" name="Grid or List button">
<xpath expr="//div[hasclass('products_header')]" position="inside">
<div class="btn-group btn-group-toggle ml-3 mb-2 d-inline-flex o_wsale_apply_layout" data-toggle="buttons">
<label t-attf-class="btn btn-light border-0 #{'active' if layout_mode != 'list' else None} fa fa-th-large o_wsale_apply_grid" title="Grid">
@@ -445,7 +445,7 @@
</div>
</template>
<template id="products_categories" inherit_id="website_sale.products" active="False" customize_show="True" name="eCommerce Categories">
<template id="products_categories" inherit_id="website_sale.products" active="False" name="eCommerce Categories">
<xpath expr="//div[@id='products_grid_before']" position="before">
<t t-set="enable_left_column" t-value="True"/>
</xpath>
@@ -493,7 +493,7 @@
</li>
</template>
<template id="option_collapse_products_categories" name="Collapsible Category List" inherit_id="website_sale.products_categories" active="False" customize_show="True">
<template id="option_collapse_products_categories" name="Collapsible Category List" inherit_id="website_sale.products_categories" active="False">
<xpath expr="//div[@id='wsale_products_categories_collapse']/ul" position="attributes">
<attribute name="id">o_shop_collapse_category</attribute>
</xpath>
@@ -502,7 +502,7 @@
</xpath>
</template>
<template id="products_attributes" inherit_id="website_sale.products" active="False" customize_show="True" name="Attributes &amp; Variants filters">
<template id="products_attributes" inherit_id="website_sale.products" active="False" name="Attributes &amp; Variants filters">
<xpath expr="//div[@id='products_grid_before']" position="before">
<t t-set="enable_left_column" t-value="True"/>
</xpath>
@@ -557,10 +557,7 @@
</xpath>
</template>
<template id="filter_products_price" inherit_id="website_sale.products" active="False" customize_show="True" name="Filter by Prices">
<xpath expr="//div[@id='products_grid_before']" position="before">
<t t-set="enable_left_column" t-value="True"/>
</xpath>
<template id="filter_products_price" inherit_id="website_sale.products" active="False" name="Filter by Prices">
<xpath expr="//div[@id='products_grid_before']" position="inside">
<div t-if="available_min_price != available_max_price" id="o_wsale_price_range_option">
<label class="m-0 h6 o_products_attributes_title">
@@ -575,7 +572,7 @@
</xpath>
</template>
<template id="products_list_view" inherit_id="website_sale.products" active="False" customize_show="True" name="List View (by default)">
<template id="products_list_view" inherit_id="website_sale.products" active="False" name="List View (by default)">
<xpath expr="//div[@id='products_grid']" position="after">
<!-- Nothing to do, this view is only meant to allow the server -->
<!-- to know if the list view layout should be used -->
@@ -598,7 +595,7 @@
<t t-call="website.layout">
<t t-set="additional_title" t-value="product.name" />
<div itemscope="itemscope" itemtype="http://schema.org/Product" id="wrap" class="js_sale">
<div itemscope="itemscope" itemtype="http://schema.org/Product" id="wrap" class="js_sale o_wsale_product_page">
<div class="oe_structure oe_empty oe_structure_not_nearest" id="oe_structure_website_sale_product_1" data-editor-message="DROP BUILDING BLOCKS HERE TO MAKE THEM AVAILABLE ACROSS ALL PRODUCTS"/>
<section t-attf-class="container py-4 oe_website_sale #{'discount' if combination_info['has_discounted_price'] else ''}" id="product_detail"
t-att-data-view-track="view_track and '1' or '0'"
@@ -715,7 +712,7 @@
</t>
</template>
<template id="product_custom_text" inherit_id="website_sale.product" active="True" customize_show="True" name="Terms and Conditions" priority="21">
<template id="product_custom_text" inherit_id="website_sale.product" active="True" name="Terms and Conditions" priority="21">
<xpath expr="//div[@id='o_product_terms_and_share']" position="inside">
<p class="text-muted mb-0">
<a href="/terms" class="text-muted"><u>Terms and Conditions</u></a><br/>
@@ -725,7 +722,7 @@
</xpath>
</template>
<template id="product_share_buttons" inherit_id="website_sale.product" active="True" customize_show="True" name="Share Buttons" priority="22">
<template id="product_share_buttons" inherit_id="website_sale.product" active="True" name="Share Buttons" priority="22">
<xpath expr="//div[@id='o_product_terms_and_share']" position="inside">
<div class="h4 mt-3 mb-0 d-flex justify-content-md-end flex-shrink-0" contenteditable="false">
<t t-snippet-call="website.s_share">
@@ -738,13 +735,13 @@
</xpath>
</template>
<template inherit_id='website_sale.product' id="product_picture_magnify" customize_show="True" name="Image Zoom">
<template inherit_id='website_sale.product' id="product_picture_magnify" name="Image Zoom">
<xpath expr='//div[hasclass("js_sale")]' position='attributes'>
<attribute name="class" separator=" " add="ecom-zoomable zoomodoo-next" />
</xpath>
</template>
<template inherit_id='website_sale.product' id="product_picture_magnify_auto" active="False" customize_show="True" name="Automatic Image Zoom">
<template inherit_id='website_sale.product' id="product_picture_magnify_auto" active="False" name="Automatic Image Zoom">
<xpath expr='//div[hasclass("js_sale")]' position='attributes'>
<attribute name="data-ecom-zoom-auto">1</attribute>
<attribute name="class" separator=" " add="ecom-zoomable zoomodoo-next" />
@@ -752,7 +749,7 @@
</xpath>
</template>
<template id="recommended_products" inherit_id="website_sale.product" customize_show="True" name="Alternative Products">
<template id="recommended_products" inherit_id="website_sale.product" name="Alternative Products">
<xpath expr="//div[@id='product_full_description']" position="after">
<t t-set="alternative_products" t-value="product._get_website_alternative_product()"/>
<div t-if="alternative_products" class="container mt32">
@@ -783,7 +780,7 @@
</template>
<!-- Product options: OpenChatter -->
<template id="product_comment" inherit_id="website_sale.product" active="False" customize_show="True" name="Discussion and Rating" priority="15">
<template id="product_comment" inherit_id="website_sale.product" active="False" name="Discussion and Rating" priority="15">
<xpath expr="//div[@t-field='product.website_description']" position="after">
<div class="o_shop_discussion_rating" data-anchor='true'>
<section id="o_product_page_reviews" class="container pt32 pb32" data-anchor='true'>
@@ -804,7 +801,7 @@
</xpath>
</template>
<template id="product_quantity" inherit_id="website_sale.product" customize_show="True" name="Select Quantity">
<template id="product_quantity" inherit_id="website_sale.product" name="Select Quantity">
<xpath expr="//t[@t-set='hasQuantities']" position="attributes">
<attribute name="t-value" remove="false" add="true" separator=" "/>
</xpath>
@@ -825,7 +822,7 @@
</xpath>
</template>
<template id="product_buy_now" inherit_id="website_sale.product" active="False" customize_show="True" name="Buy Now Button">
<template id="product_buy_now" inherit_id="website_sale.product" active="False" name="Buy Now Button">
<xpath expr="//t[@t-set='hasBuyNow']" position="attributes">
<attribute name="t-value" remove="false" add="true" separator=" "/>
</xpath>
@@ -874,7 +871,7 @@
</div>
</template>
<template id="product_variants" inherit_id="website_sale.product" active="False" customize_show="True" name="List View of Variants">
<template id="product_variants" inherit_id="website_sale.product" active="False" name="List View of Variants">
<xpath expr="//t[@t-placeholder='select']" position="replace">
<!--
Using this setting with dynamic variants is not supported.
@@ -1018,7 +1015,7 @@
</t>
</template>
<template id="extra_info_option" name="Extra Step Option" inherit_id="wizard_checkout" active="False" customize_show="True">
<template id="extra_info_option" name="Extra Step Option" inherit_id="wizard_checkout" active="False">
<!-- Add a "flag element" to trigger style variation -->
<xpath expr="//div[hasclass('wizard')]/div" position="before">
<span class="o_wizard_has_extra_step d-none"/>
@@ -1268,7 +1265,7 @@
</t>
</template>
<template id="suggested_products_list" inherit_id="website_sale.cart_lines" customize_show="True" name="Alternative Products in my cart">
<template id="suggested_products_list" inherit_id="website_sale.cart_lines" name="Alternative Products in my cart">
<xpath expr="//table[@id='cart_products']" position="after">
<h5 class='text-muted js_cart_lines' t-if="suggested_products">Suggested Accessories:</h5>
<table t-if="suggested_products" id="suggested_products" class="js_cart_lines table table-striped table-sm">
@@ -1582,7 +1579,7 @@
</t>
</template>
<template id="address_b2b" inherit_id="address" name="Show b2b fields" customize_show="True">
<template id="address_b2b" inherit_id="address" name="Show b2b fields">
<xpath expr="//div[@id='div_phone']" position="after">
<div class="w-100"/>
<t t-set='vat_warning' t-value="'vat' in checkout and checkout['vat'] and not can_edit_vat" />
@@ -1710,7 +1707,7 @@
</div>
</template>
<template id="payment_sale_note" inherit_id="payment_footer" name="Accept Terms &amp; Conditions" customize_show="True" active="False">
<template id="payment_sale_note" inherit_id="payment_footer" name="Accept Terms &amp; Conditions" active="False">
<xpath expr="//div[@name='o_checkbox_container']" position="inside">
<input type="checkbox" id="checkbox_tc" class="custom-control-input"/>
<label for="checkbox_tc" class="custom-control-label">
@@ -1905,7 +1902,7 @@
</div>
</template>
<template id="reduction_code" inherit_id="website_sale.total" customize_show="True" name="Promo Code">
<template id="reduction_code" inherit_id="website_sale.total" name="Promo Code">
<xpath expr="//div[@id='cart_total']//table/tr[last()]" position="after">
<tr t-if="not hide_promotions">
<td colspan="3" class="text-center text-xl-right border-0">
@@ -1992,7 +1989,7 @@
<template id="website_sale.shop_product_carousel" name="Shop Product Carousel">
<t t-set="product_images" t-value="product_variant._get_images() if product_variant else product._get_images()"/>
<t t-set="product_carousel_block_name">Product Carousel</t>
<t t-set="product_carousel_block_name">Product Image</t>
<div id="o-carousel-product" class="carousel slide position-sticky mb-3 overflow-hidden" data-ride="carousel" data-interval="0" t-att-data-name="product_carousel_block_name">
<div class="o_carousel_product_outer carousel-outer position-relative flex-grow-1">
<div class="carousel-inner h-100">
@@ -18,6 +18,7 @@ Finally, the module comes with an option to display an attribute summary table i
'security/ir.model.access.csv',
'views/website_sale_comparison_template.xml',
'views/website_sale_comparison_view.xml',
'views/snippets.xml',
],
'demo': [
'data/website_sale_comparison_data.xml',
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="snippet_options" inherit_id="website.snippet_options" name="Comparison Snippet Options">
<xpath expr="." position="inside">
<div data-selector="main:has(.o_wsale_product_page)" data-no-check="true">
<we-select string="Attributes" data-no-preview="true" data-reload="/">
<we-button data-customize-website-views="">None</we-button>
<we-button data-customize-website-views="website_sale_comparison.product_attributes_body">Bottom of Page</we-button>
</we-select>
</div>
</xpath>
<xpath expr="//we-button[hasclass('o_we_add_to_cart_btn')]" position="after">
<we-button title="Compare" class="fa fa-fw fa-exchange"
data-customize-website-views="website_sale_comparison.add_to_compare"
data-no-preview="true"
data-reload="/"/>
</xpath>
</template>
</odoo>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="add_to_compare" inherit_id="website_sale.products_item" customize_show="True" name="Comparison List" priority="22">
<template id="add_to_compare" inherit_id="website_sale.products_item" name="Comparison List" priority="22">
<xpath expr="//div[hasclass('o_wsale_product_btn')]" position="inside">
<t t-set="categories" t-value="product.valid_product_template_attribute_line_ids._prepare_categories_for_display()"/>
<t t-set="product_variant_id" t-value="product._get_first_possible_variant_id()"/>
@@ -9,7 +9,7 @@
</xpath>
</template>
<template id="product_attributes_body" inherit_id="website_sale.product" customize_show="True" name="Product attributes table">
<template id="product_attributes_body" inherit_id="website_sale.product" name="Product attributes table">
<xpath expr="//div[@id='product_attributes_simple']" position="replace"/>
<xpath expr="//div[@id='product_full_description']" position="after">
<t t-set="categories" t-value="product.valid_product_template_attribute_line_ids._prepare_categories_for_display()"/>
@@ -19,6 +19,7 @@ Coupon & promotion programs can be edited in the Catalog menu of the Website app
'views/loyalty_program_views.xml',
'views/website_sale_templates.xml',
'views/res_config_settings_views.xml',
'views/snippets.xml',
],
'demo': [
'data/product_demo.xml',
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="snippet_options" inherit_id="website.snippet_options" name="Coupon Snippet Options">
<xpath expr="." position="inside">
<div data-selector="main:has(.oe_website_sale .wizard)" data-no-check="true">
<we-checkbox string="Show Discount in Subtotal"
data-customize-website-views="website_sale_loyalty.cart_discount"
data-no-preview="true"
data-reload="/"/>
</div>
</xpath>
</template>
</odoo>
@@ -108,7 +108,7 @@
</body>
</template>
<template id="cart_discount" name="Show Discount in Subtotal" customize_show="True" active="False" inherit_id="website_sale.total">
<template id="cart_discount" name="Show Discount in Subtotal" active="False" inherit_id="website_sale.total">
<xpath expr="//tr[@id='order_total_untaxed']" position="before">
<tr t-if="website_sale_order and website_sale_order.reward_amount">
<td class="text-right border-0 text-muted" title="Discounted amount">Discount:</td>
@@ -16,6 +16,7 @@
'views/slide_channel_views.xml',
'views/website_sale_templates.xml',
'views/website_slides_templates.xml',
'views/snippets.xml',
],
'demo': [
'data/product_demo.xml',
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="snippet_options" inherit_id="website.snippet_options" name="Slides Snippet Options">
<xpath expr="." position="inside">
<div data-selector="main:has(.o_wslides_course_header)" data-page-options="true" data-no-check="true" string="Course Page">
<we-checkbox string="Buy Now Button"
data-customize-website-views="website_sale_slides.course_option_buy_course_now"
data-no-preview="true"
data-reload="/"/>
</div>
</xpath>
</template>
</odoo>
@@ -137,7 +137,7 @@
</t>
</template>
<template name="Display 'Buy Now'" id="course_option_buy_course_now" inherit_id="website_sale_slides.course_buy_course_button" active="False" customize_show="True">
<template name="Display 'Buy Now'" id="course_option_buy_course_now" inherit_id="website_sale_slides.course_buy_course_button" active="False">
<xpath expr="//div[hasclass('add_to_cart_button')]" position="before">
<div class="mb-1">
<!-- FIXME TDE seems strange to redirect to /cart/update with get params when it only supports POST requests -->
@@ -12,6 +12,18 @@
data-reload="/"/>
</div>
</xpath>
<xpath expr="//we-button[hasclass('o_we_add_to_cart_btn')]" position="after">
<we-button title="Wishlist" class="fa fa-fw fa-heart"
data-customize-website-views="website_sale_wishlist.add_to_wishlist"
data-no-preview="true"
data-reload="/"/>
</xpath>
<xpath expr="//we-button[hasclass('o_we_buy_now_btn')]" position="after">
<we-button title="Wishlist" class="fa fa-fw fa-heart"
data-customize-website-views="website_sale_wishlist.product_add_to_wishlist"
data-no-preview="true"
data-reload="/"/>
</xpath>
</template>
</odoo>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="add_to_wishlist" inherit_id="website_sale.products_item" customize_show="True" name="Wishlist Button" priority="20">
<template id="add_to_wishlist" inherit_id="website_sale.products_item" name="Wishlist Button" priority="20">
<xpath expr="//div[hasclass('o_wsale_product_btn')]" position="inside">
<t t-nocache="The wishlist depends on the user and must not be shared with other users. As this rendering is in the loop, the product value is set in the template, we must retain the id of the product on which we are."
t-nocache-product_template_id="product.id">
@@ -13,7 +13,7 @@
</xpath>
</template>
<template id="product_add_to_wishlist" inherit_id="website_sale.product" customize_show="True" name="Wishlist Button" priority="20">
<template id="product_add_to_wishlist" inherit_id="website_sale.product" name="Wishlist Button" priority="20">
<xpath expr="//div[@id='product_option_block']" position="inside">
<t t-nocache="The wishlist depends on the user and must not be shared with other users. The product come from the controller.">
<t t-set="product_variant" t-value="product_variant or product._create_first_product_variant()"/>