[FIX] website_sale: shows correct product attribute display_type

__Current behavior before commit:__
When changing the `display_type` of an attribute in the website editor,
the page is reloaded. However the template `website_sale.product` is
contained in a `t-cache` on "pricelist,product". This means that the
template will not be rendered again when the page is reloaded. Thus, the
change will not appear for the user.

__Description of the fix:__
Flush the cache from the `ir.qweb` model when the attribute display type
is edited. This way the template `website_sale.product` will be
refreshed.

__Steps to reproduce the issue on runbot:__
- Go on the website product page of *Customizable Desk*
- Open the website editor
- Click on the Legs attribute values
- Under the **Block** section, change the **Display Type**

The page is reloaded but the display type stays the same

([Video][1])

opw-3495159
opw-3493820

[1]: https://drive.google.com/file/d/142VP4prnHskfa7uFoEkadsoQfQVO-uyW/view

closes odoo/odoo#137498

X-original-commit: cc8664973efd7ea3433b5ec5b741f0882fb17dc0
Signed-off-by: Julien Launois (jula) <jula@odoo.com>
This commit is contained in:
Julien (jula)
2023-10-10 14:07:11 +00:00
parent daecbbac50
commit 2a41bfcb4d
+1
View File
@@ -1800,6 +1800,7 @@ class WebsiteSale(payment_portal.PaymentPortal):
attribute = request.env['product.attribute'].browse(attribute_id)
if 'display_type' in options:
attribute.write({'display_type': options['display_type']})
request.env.registry.clear_cache('templates')
@http.route(['/shop/config/website'], type='json', auth='user')
def _change_website_config(self, **options):