This commit is contained in:
2026-03-20 10:36:27 +01:00
parent 8c3ba0a23d
commit b2e095aad5
3 changed files with 26 additions and 2 deletions

View File

@@ -557,6 +557,11 @@ class QualityAnalysis(ModelSQL,ModelView):
fields.Many2One('product.attribute.set', "Attribute Set"),
'on_change_with_attribute_set'
)
attributes_name = fields.Function(
fields.Char("Attributes Name"),
'on_change_with_attributes_name'
)
@fields.depends('product')
def on_change_with_attribute_set(self, name=None):
@@ -567,6 +572,25 @@ class QualityAnalysis(ModelSQL,ModelView):
def on_change_with_product(self, name=None):
if self.line:
return self.line.product
@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))
class Line(metaclass=PoolMeta):
__name__ = 'purchase.line'