From 2120e667b9098a6a74788d8311bd2833a65c6ac8 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Fri, 26 Jan 2018 14:04:13 +0100 Subject: [PATCH] [FIX] website_sale: variants view, currency price and price diff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: 1. When enabling 'List View of Variants' on a product page, it would not replace the variant normal view as it should since the code being replaced is included in the code replacing it. 2.The badge specifying the price difference between the variance and the product base price would be calculated by taking the price_extra of the variance attribute and converting it in the user currency which was not correct if a pricelist was set on the product variant because the price diff would then be (the variant price set on the pricelist) - (product base price) Note: this is about the 'List View of Variants' mode, not the normal mode which list variant attribute and not variant itself 3. The strikethrough amount was not in the user currency Step to reproduce: - Enable variants & pricelists - Enable multi-currency and activate 'COP' as second currency (you may want to change the currency symbol on edit mode since it is also '$') - Go to iPad Retina Display product page in shop - Enable 'List View of Variants' in 'Customize' - Both Variants selection mode are visible (bug 1) - The third variant shows '+$ 50.40' which is the diff between the strikethrough prices (in fact the sum of the price_extra of the product variant attributes, +50,40 on the 32GO attribute in this case) It should show '+$ 40.32' since the price change from $600 to $640.32. This is bug n°2 - Change Public Pricelist currency from USD to COP - Back on iPad page, change between the 3 product variants, you will see the $ price strikedthrough instead of the COP one: Strikedthrough: 750 (it should be 1 714 491,47) Price: 1 371 593,17 This is bug 3 - You can notice the bug n°2 being more visible since it shows '+$ 115 213,83' instead of '+ 92 171.07' - Remove the iPad Retina from Public Pricelist and add iPad Retina 32Go variant to it with a fix price of $1 000 000. - '32Gb, 2.4GHz, White' variant cost $1 000 000 but shows '+ 115 213.83' instead of '- 714 491.47' since the base price of Retina is '1 714 491.47'. - You can play with the pricelist price for this variant up and down, the diff price shown in the badge will always be 115 213.83 since it will always calculate it by summing all the variant's attribute price_extra and then converting it to the user currency. This closes #14094, closes #22553 --- addons/website_sale/views/templates.xml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index b260d26af7e..7e45ae5d56c 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -449,19 +449,13 @@