[FIX] website_sale: restrict types for displayable extra fields

- Install eCommerce
- Enable debug mode
- Go to Website > Configuration > Websites
- Configure Website by adding a Selection field in "Product Page Extra Fields" (i.e. Product Type)
- Go to Website and from Shop, open a Product
- In Customize menu, enable "Show Extra Fields" options
A KeyError is raised with "selection" key.

By using "selection" widget, the value is processed by SelectionConverter, which tries
to retrieve the text linked to the value by accessing missing "selection" dict in options.

As the feature was originally designed to support "char" and "binary" types, the selection
of extra fields displayable on eCommerce Product page will be restricted to these 2 types.

opw-2378753

closes odoo/odoo#62151

X-original-commit: 87ea687169c9a0047b41b11ab143544142c82aae
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
This commit is contained in:
Anh Thao Pham (pta)
2020-11-23 09:55:10 +00:00
parent 4f4c643a0b
commit adf087f203
+1 -1
View File
@@ -394,7 +394,7 @@ class WebsiteSaleExtraField(models.Model):
sequence = fields.Integer(default=10)
field_id = fields.Many2one(
'ir.model.fields',
domain=[('model_id.model', '=', 'product.template')]
domain=[('model_id.model', '=', 'product.template'), ('ttype', 'in', ['char', 'binary'])]
)
label = fields.Char(related='field_id.field_description')
name = fields.Char(related='field_id.name')