[FIX] website_sale: sale ribbons disappearing

Current behaviour:
When removing the ribbon from a product,
the other ribbons are removed as well.

Steps to reproduce:
1. Go to website
2. Go to Shop
3. Click on Edit (top right)
4. Add a ribbon to multiple products
5. Click on Save
6. Select a product with a ribbon
7. Remove the ribbon
8. (other ribbons are gone)

Cause of the issue:
Reverting fix introduced by https://github.com/odoo/odoo/commit/5d13fa522e7d06b03a098ada5fa6be15ddc49618
t-out was modified into t-field to be considered dirty when modified.
but when removing a ribbon, t-field is set as empty,
which overwrites ribbons html value.

opw-3487397

closes odoo/odoo#145864

X-original-commit: 71bdf1f674d0340a726dba96c65af6fdff25822f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Antoine (ande)
2023-12-12 10:34:48 +00:00
parent ae9efe2a17
commit d3487fad36
+1 -1
View File
@@ -199,7 +199,7 @@
<t t-set="bg_color" t-value="td_product['ribbon']['bg_color'] or ''"/>
<t t-set="text_color" t-value="td_product['ribbon']['text_color']"/>
<t t-set="bg_class" t-value="td_product['ribbon']['html_class']"/>
<span t-attf-class="o_ribbon o_not_editable #{bg_class}" t-attf-style="#{text_color and ('color: %s; ' % text_color)}#{bg_color and 'background-color:' + bg_color}" t-field="product.website_ribbon_id.html"/>
<span t-attf-class="o_ribbon o_not_editable #{bg_class}" t-attf-style="#{text_color and ('color: %s; ' % text_color)}#{bg_color and 'background-color:' + bg_color}" t-out="td_product['ribbon']['html'] or ''"/>
</a>
</div>
<div class="o_wsale_product_information position-relative d-flex flex-column flex-grow-1 flex-shrink-1">