[FIX] website_sale: display correct price according in carousel
Steps to reproduce: 1) Create product P for $1000, with 15% Tax, publish to website. 1-bis) make sure the 15% tax is "included" 2) Settings -> search 'price' -> Tax Excluded. 3) Go to website /shop page, and edit to place the Products block, and search for Issue: The price displayed on the product in "86.96" (correct) but the price on the product in the carousel displays "100.00" Cause: The price for the carousel is not fetched the same way https://github.com/odoo/odoo/blob/e829b345f0f5e5346be416b8354c29fa9acb74a7/addons/website_sale/data/product_snippet_template_data.xml#L388 And the method does not take into account this fourth scenario. That is: - a tax with price_include set to True - a show_line_subtotals_tax_selection config parameter set to "tax_excluded" Note: There is an issue with the case of a mapping from a tax included to a tax included: ``` param_main_product_tax_included = True param_fpos = 'to_tax_included' # mapping from 15% to 10% ``` As if the product price is 100, the tax set on the product is 15%. ``` >>> self.env['account.tax']._fix_tax_included_price_company( price, product_taxes, taxes, self.env.company.id) 86.96 ``` The price would be 100/1.15 = 86.96 And when calling `taxes.compute_all(price, product=self, partner=self.env['res.partner'])` it would return ``` included = 86.96 ; excluded = 79.05 ``` The base is computed by taking the initial base such as ``` 100/1.15/1.1 = 79.05 ``` Instead of keeping the initial base and applying the new tax percentage to compute the total included ``` base = 100/1.15 = 86.96 total_included = 86.96 * 1.10 = 95.656 amount_tax = 8.696 ``` After some discussion, it turns out this problem is a known issue. To make the mapping from 'tax_included' to 'tax_included' more sensible, we'd need to make some additional changes beyond what we're addressing in this fix. opw-3370999 closes odoo/odoo#133501 Signed-off-by:Yolann Sabaux (yosa) <yosa@odoo.com>
Please register or sign in to comment