[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>
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user