summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2019-09-09 12:54:41 +0000
committerSébastien Theys <seb@odoo.com>2019-09-09 12:54:41 +0000
commit331e1f70ec143a8a0f42acabb034abff1e6559ee (patch)
tree1e7fc5b0556ce0dbc020ef55431cbe6871eb1acf
parent029dd1a214f727e25b479610df96b7ee94dd8127 (diff)
[IMP] (website_)sale(_comparison): remove 12.0 compatibility code
This code was introduced for fixes in stable version but it is not used now. closes odoo/odoo#36365 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
-rw-r--r--addons/sale/static/src/js/variant_mixin.js11
-rw-r--r--addons/website_sale/static/src/js/website_sale.js61
-rw-r--r--addons/website_sale/views/templates.xml4
-rw-r--r--addons/website_sale_comparison/views/website_sale_comparison_template.xml8
4 files changed, 17 insertions, 67 deletions
diff --git a/addons/sale/static/src/js/variant_mixin.js b/addons/sale/static/src/js/variant_mixin.js
index b03d3c623c8..147a54a5e79 100644
--- a/addons/sale/static/src/js/variant_mixin.js
+++ b/addons/sale/static/src/js/variant_mixin.js
@@ -301,11 +301,6 @@ var VariantMixin = {
JSON.stringify(self.getSelectedVariantValues($container)),
};
- // Note about 12.0 compatibility: this route will not exist if
- // updating the code but not restarting the server. (404)
- // We don't handle that compatibility because the previous code was
- // not working either: it was making an RPC that failed with any
- // non-admin user anyway. To use this feature, restart the server.
var route = '/sale/create_product_variant';
if (useAjax) {
productReady = ajax.jsonRpc(route, 'call', params);
@@ -458,11 +453,7 @@ var VariantMixin = {
}
this._toggleDisable($parent, isCombinationPossible);
-
- // compatibility_check to remove in master
- // needed for fix in 12.0 in the case of git pull and no server restart
- var compatibility_check = combination.list_price - combination.price >= 0.01;
- if (combination.has_discounted_price !== undefined ? combination.has_discounted_price : compatibility_check) {
+ if (combination.has_discounted_price) {
$default_price
.closest('.oe_website_sale')
.addClass("discount");
diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js
index 9ce94c90448..ef636055df4 100644
--- a/addons/website_sale/static/src/js/website_sale.js
+++ b/addons/website_sale/static/src/js/website_sale.js
@@ -414,56 +414,21 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, {
* @override
* @private
*/
- _updateProductImage: function ($productContainer, displayImage, productId, productTemplateId, new_carousel, isCombinationPossible) {
- var $img;
+ _updateProductImage: function ($productContainer, displayImage, productId, productTemplateId, newCarousel, isCombinationPossible) {
var $carousel = $productContainer.find('#o-carousel-product');
-
- if (isCombinationPossible === undefined) {
- isCombinationPossible = this.isSelectedVariantAllowed;
+ // When using the web editor, don't reload this or the images won't
+ // be able to be edited depending on if this is done loading before
+ // or after the editor is ready.
+ if (window.location.search.indexOf('enable_editor') === -1) {
+ var $newCarousel = $(newCarousel);
+ $carousel.after($newCarousel);
+ $carousel.remove();
+ $carousel = $newCarousel;
+ $carousel.carousel(0);
+ this._startZoom();
+ // fix issue with carousel height
+ this.trigger_up('widgets_start_request', {$target: $carousel});
}
-
- if (new_carousel) {
- // When using the web editor, don't reload this or the images won't
- // be able to be edited depending on if this is done loading before
- // or after the editor is ready.
- if (window.location.search.indexOf('enable_editor') === -1) {
- var $new_carousel = $(new_carousel);
- $carousel.after($new_carousel);
- $carousel.remove();
- $carousel = $new_carousel;
- $carousel.carousel(0);
- this._startZoom();
- // fix issue with carousel height
- this.trigger_up('widgets_start_request', {$target: $carousel});
- }
- }
- else { // compatibility 12.0
- var model = productId ? 'product.product' : 'product.template';
- var modelId = productId || productTemplateId;
- var imageSrc = '/web/image/{0}/{1}/image_1024'
- .replace("{0}", model)
- .replace("{1}", modelId);
-
- $img = $productContainer.find('img.js_variant_img');
- $img.attr("src", imageSrc);
- $img.parent().attr('data-oe-model', model).attr('data-oe-id', modelId)
- .data('oe-model', model).data('oe-id', modelId);
-
- var $thumbnail = $productContainer.find('img.js_variant_img_small');
- if ($thumbnail.length !== 0) { // if only one, thumbnails are not displayed
- $thumbnail.attr("src", "/web/image/{0}/{1}/image_128/90x90"
- .replace('{0}', model)
- .replace('{1}', modelId));
- $('.carousel').carousel(0);
- }
-
- // reset zooming constructs
- $img.filter('[data-zoom-image]').attr('data-zoom-image', $img.attr('src'));
- if ($img.data('zoomOdoo') !== undefined) {
- $img.data('zoomOdoo').isReady = false;
- }
- }
-
$carousel.toggleClass('css_not_available', !isCombinationPossible);
},
/**
diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml
index c16b7862491..6e1eab7c323 100644
--- a/addons/website_sale/views/templates.xml
+++ b/addons/website_sale/views/templates.xml
@@ -1011,9 +1011,7 @@
<div class="text-muted d-none d-md-block" t-field="product.description_sale" />
</td>
<td class='td-price'>
- <t t-if="True"><!-- compatibility 12.0 -->
- <del t-attf-class="text-danger mr8 {{'' if combination_info['has_discounted_price'] else 'd-none'}}" style="white-space: nowrap;" t-esc="combination_info['list_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
- </t>
+ <del t-attf-class="text-danger mr8 {{'' if combination_info['has_discounted_price'] else 'd-none'}}" style="white-space: nowrap;" t-esc="combination_info['list_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
<span t-esc="combination_info['price']" style="white-space: nowrap;" t-options="{'widget': 'monetary','display_currency': website.currency_id}"/>
</td>
<td class="w-25 text-center">
diff --git a/addons/website_sale_comparison/views/website_sale_comparison_template.xml b/addons/website_sale_comparison/views/website_sale_comparison_template.xml
index 0d00ca84e06..6233bed257b 100644
--- a/addons/website_sale_comparison/views/website_sale_comparison_template.xml
+++ b/addons/website_sale_comparison/views/website_sale_comparison_template.xml
@@ -120,9 +120,7 @@
<span>
<strong>Price:</strong>
- <t t-if="True"><!-- compatibility 12.0-->
- <del t-attf-class="text-danger mr8 {{'' if combination_info['has_discounted_price'] else 'd-none'}}" style="white-space: nowrap;" t-esc="combination_info['list_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}" />
- </t>
+ <del t-attf-class="text-danger mr8 {{'' if combination_info['has_discounted_price'] else 'd-none'}}" style="white-space: nowrap;" t-esc="combination_info['list_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}" />
<span t-esc="combination_info['price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"></span>
</span>
@@ -166,9 +164,7 @@
<div class="col-8 pl-2">
<h6>
<a t-att-href="product.website_url"><t t-esc="combination_info['display_name']" /></a><br/>
- <t t-if="True"><!--compatibility 12.0-->
- <del t-attf-class="text-danger mr8 {{'' if combination_info['has_discounted_price'] else 'd-none'}}" style="white-space: nowrap;" t-esc="combination_info['list_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}" />
- </t>
+ <del t-attf-class="text-danger mr8 {{'' if combination_info['has_discounted_price'] else 'd-none'}}" style="white-space: nowrap;" t-esc="combination_info['list_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}" />
<span t-esc="combination_info['price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"></span>
</h6>
</div>