[FIX] website_sale: fix ribbon editing

To reproduce
=============
- Go to shop page
- Edit the page
- select a product
- add a ribbon
- modify the ribbon (background or text color)
the ribbon is not updated

Problem
=======
the default ribbon are using the bootstrap class "text-bg-*" to set the
background color and the text color. But the editor expects the ribbon
to have a class "bg-*" and color css style. That's why when editing, the
class "text-bg-*" is never removed so each time it's taken instead of the
added style.

Solution
========
remove the class "text-bg-*" from default ribbons and use the fields
"bg_color" and "text_color" to set the background and text color

opw-3674520

closes odoo/odoo#152604

X-original-commit: 2bd09b4b41b27780ec20820cac76051ae20b7f4d
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Abdelouahab Laaroussi (abla) <abla@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2024-02-03 09:50:19 +00:00
parent 226b669993
commit 31df8066ba
+12 -4
View File
@@ -25,22 +25,30 @@
<record id="website_sale.sale_ribbon" model="product.ribbon">
<field name="html">Sale</field>
<field name="html_class">text-bg-success o_ribbon_left</field>
<field name="html_class">o_ribbon_left</field>
<field name="bg_color">rgb(40, 167, 69)</field>
<field name="text_color">white</field>
</record>
<record id="website_sale.sold_out_ribbon" model="product.ribbon">
<field name="html">Sold out</field>
<field name="html_class">text-bg-danger o_ribbon_left</field>
<field name="html_class">o_ribbon_left</field>
<field name="bg_color">rgb(220, 53, 69)</field>
<field name="text_color">white</field>
</record>
<record id="website_sale.out_of_stock_ribbon" model="product.ribbon">
<field name="html">Out of stock</field>
<field name="html_class">text-bg-warning o_ribbon_left</field>
<field name="html_class">o_ribbon_left</field>
<field name="bg_color">rgb(255, 193, 7)</field>
<field name="text_color">black</field>
</record>
<record id="website_sale.new_ribbon" model="product.ribbon">
<field name="html">New!</field>
<field name="html_class">text-bg-primary o_ribbon_left</field>
<field name="html_class">o_ribbon_left</field>
<field name="bg_color">rgb(0, 123, 255)</field>
<field name="text_color">white</field>
</record>
<record id="sales_team.salesteam_website_sales" model="crm.team">