diff --git a/product_variant_sale_price/models/product_product.py b/product_variant_sale_price/models/product_product.py index 2e9585aec..499d9a126 100644 --- a/product_variant_sale_price/models/product_product.py +++ b/product_variant_sale_price/models/product_product.py @@ -63,9 +63,8 @@ def _inverse_product_lst_price(self): if product.product_variant_count == 1: product.product_tmpl_id.list_price = vals["fix_price"] else: - fix_prices = product.product_tmpl_id.mapped( - "product_variant_ids.fix_price" - ) + other_products = product.product_tmpl_id.product_variant_ids - product + fix_prices = other_products.mapped("fix_price") + [product.lst_price] # for consistency with price shown in the shop product.product_tmpl_id.with_context( skip_update_fix_price=True diff --git a/product_variant_sale_price/tests/test_product_product.py b/product_variant_sale_price/tests/test_product_product.py index dfd71ea7a..5855f324d 100644 --- a/product_variant_sale_price/tests/test_product_product.py +++ b/product_variant_sale_price/tests/test_product_product.py @@ -67,11 +67,11 @@ def test_post_init_hook(self): ) # Flush the records to DB before direct SQL - self.product_blue.flush() - self.product_red.flush() + self.product_template.product_variant_ids.flush_model() + self.product_blue.product_template_attribute_value_ids.flush_model() set_sale_price_on_variant(self.cr, None, self.product_template.id) - self.product_template.product_variant_ids.invalidate_cache() + self.product_blue.invalidate_model() self.assertEqual( self.product_template.list_price + 100.00, self.product_blue.lst_price ) diff --git a/product_variant_sale_price/views/product_views.xml b/product_variant_sale_price/views/product_views.xml index d2da65ff1..ac2ea7a3b 100644 --- a/product_variant_sale_price/views/product_views.xml +++ b/product_variant_sale_price/views/product_views.xml @@ -5,37 +5,53 @@ product.template - - {'invisible': [ - ('product_variant_count', '>', 1) - ]} - + + + Setting the price here will update all variants. + + - + product.product - + - - - + + + + - - product.product - + + + product.template.attribute.value.tree.hide.extra + product.template.attribute.value + + + + 1 + + + + + product.template.attribute.value.form.hide.extra + product.template.attribute.value + - - - + + 1 +