This commit is contained in:
2026-03-20 13:50:31 +01:00
parent 4f6641ceeb
commit a2e0c36a3c
3 changed files with 27 additions and 3 deletions

View File

@@ -148,6 +148,30 @@ class Product(ModelSQL,ModelView):
'on_change_with_attribute_set'
)
attributes_name = fields.Function(
fields.Char("Details"),
'on_change_with_attributes_name'
)
@fields.depends('product', 'attributes')
def on_change_with_attributes_name(self, name=None):
if not self.product or not self.product.attribute_set or not self.attributes:
return
def key(attribute):
return getattr(attribute, 'sequence', attribute.name)
values = []
for attribute in sorted(self.product.attribute_set.attributes, key=key):
if attribute.name in self.attributes:
value = self.attributes[attribute.name]
values.append(gettext(
'product_attribute.msg_label_value',
label=attribute.string,
value=attribute.format(value)
))
return " | ".join(filter(None, values))
@fields.depends('product')
def on_change_with_attribute_set(self, name=None):
if self.product and self.product.template and self.product.template.attribute_set:

View File

@@ -1,6 +1,6 @@
<form>
<label name="price"/>
<field name="price"/>
<label name="product"/>
<field name="product"/>
<label name="attribute"/>
<field name="attribute"/>
</form>

View File

@@ -1,5 +1,5 @@
<tree>
<field name="price"/>
<field name="product"/>
<field name="attribute"/>
<field name="attributes_name"/>
</tree>