20.03.26
This commit is contained in:
@@ -148,30 +148,6 @@ class Product(ModelSQL,ModelView):
|
|||||||
'on_change_with_attribute_set'
|
'on_change_with_attribute_set'
|
||||||
)
|
)
|
||||||
|
|
||||||
attributes_name = fields.Function(
|
|
||||||
fields.Char("Attribute"),
|
|
||||||
'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')
|
@fields.depends('product')
|
||||||
def on_change_with_attribute_set(self, name=None):
|
def on_change_with_attribute_set(self, name=None):
|
||||||
if self.product and self.product.template and self.product.template.attribute_set:
|
if self.product and self.product.template and self.product.template.attribute_set:
|
||||||
|
|||||||
Reference in New Issue
Block a user