diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 2de1d3732b7..44e34157c0d 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -595,6 +595,8 @@ class WebsiteSale(http.Controller): other_image = product_images[new_image_idx] source_field = hasattr(image_to_resequence, 'video_url') and image_to_resequence.video_url and 'video_url' or 'image_1920' target_field = hasattr(other_image, 'video_url') and other_image.video_url and 'video_url' or 'image_1920' + if target_field == 'video_url' and image_res_model == 'product.product': + raise ValidationError(_("Can not resequence a video at first position.")) previous_data = other_image[target_field] other_image[source_field] = image_to_resequence[source_field] image_to_resequence[target_field] = previous_data diff --git a/addons/website_sale/i18n/website_sale.pot b/addons/website_sale/i18n/website_sale.pot index 5732ff4cc4c..2330e53bc78 100644 --- a/addons/website_sale/i18n/website_sale.pot +++ b/addons/website_sale/i18n/website_sale.pot @@ -996,6 +996,13 @@ msgstr "" msgid "Can Publish" msgstr "" +#. module: website_sale +#. odoo-python +#: code:addons/website_sale/controllers/main.py:0 +#, python-format +msgid "Can not resequence a video at first position." +msgstr "" + #. module: website_sale #. odoo-python #: code:addons/website_sale/controllers/main.py:0