summaryrefslogtreecommitdiff
path: root/addons/website_sale/models
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2020-11-30 17:12:27 +0000
committerJeremy Kersten <jke@odoo.com>2020-11-30 17:12:34 +0000
commitf70f017a04c4d0e2aaf378cce9541b01b42ed0a7 (patch)
treeca2d6fac5591b6502076994b20a06de288fc8dd1 /addons/website_sale/models
parent902d2d9a91f9a1167fd1f51ad71c021cc1e6bfc1 (diff)
[FIX] website: add missing rec_name
Override name_get to remove html from name this commit clsoes #60204 closes odoo/odoo#62642 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website_sale/models')
-rw-r--r--addons/website_sale/models/product.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py
index 6112982e4bf..caecf35012f 100644
--- a/addons/website_sale/models/product.py
+++ b/addons/website_sale/models/product.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, fields, models, _
+from odoo import api, fields, models, tools, _
from odoo.exceptions import ValidationError, UserError
from odoo.addons.http_routing.models.ir_http import slug
from odoo.addons.website.models import ir_http
@@ -13,7 +13,10 @@ class ProductRibbon(models.Model):
_name = "product.ribbon"
_description = 'Product ribbon'
- html = fields.Char(string='Ribbon html', required=True)
+ def name_get(self):
+ return [(ribbon.id, '%s (#%d)' % (tools.html2plaintext(ribbon.html), ribbon.id)) for ribbon in self]
+
+ html = fields.Char(string='Ribbon html', required=True, translate=True)
bg_color = fields.Char(string='Ribbon background color', required=False)
text_color = fields.Char(string='Ribbon text color', required=False)
html_class = fields.Char(string='Ribbon class', required=True, default='')