From 6d910be3138d8f92cb95fe4057dbe475240f87f3 Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Tue, 11 Oct 2022 12:25:49 +0000 Subject: [PATCH] [FIX] website_sale: base unit price not updated with pricelist and tax Steps to reproduce: - set a price on the product form; - set a base unit count on the product form; - define at least a pricelist with an other price; - go to website on the product page; - change the selected pricelist; - change the Tax-Excluded/Included option. Issue: The base unit price ignores the tax included option. Solution: Update the display of the base unit price taking into consideration that it is not possible to set the "base_unit_price" field (otherwise we risk an AccessError). Calculate the base unit price using "list_price" (which takes into account the tax) when we need to display it without saving. opw-2995474 closes odoo/odoo#104302 X-original-commit: b766d68287b73b70a784e7291c567fb2e59de0c3 Signed-off-by: William Braeckman (wbr) Signed-off-by: Lefebvre Thomas (thle) --- addons/website_sale/models/product_template.py | 2 +- addons/website_sale/views/templates.xml | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/website_sale/models/product_template.py b/addons/website_sale/models/product_template.py index 098ac7ac90d..31dda620ed7 100644 --- a/addons/website_sale/models/product_template.py +++ b/addons/website_sale/models/product_template.py @@ -272,7 +272,7 @@ class ProductTemplate(models.Model): prevent_zero_price_sale = not price and current_website.prevent_zero_price_sale combination_info.update( base_unit_name=product.base_unit_name, - base_unit_price=base_unit_price, + base_unit_price=product.base_unit_count and list_price / product.base_unit_count, price=price, list_price=list_price, price_extra=price_extra, diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index e1e1d322a97..fc842247bd5 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -870,10 +870,8 @@