05.03.26
This commit is contained in:
@@ -501,16 +501,28 @@ class Line(metaclass=PoolMeta):
|
||||
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'
|
||||
)
|
||||
|
||||
att_desc = fields.Function(fields.Char("Attributes"),'get_attributes')
|
||||
|
||||
def get_attributes(self, name):
|
||||
if not self.attributes:
|
||||
return ''
|
||||
|
||||
parts = []
|
||||
for attribute, value in self.attributes.items():
|
||||
parts.append(f"{attribute.name}: {value}")
|
||||
|
||||
return ', '.join(parts)
|
||||
|
||||
@fields.depends('product')
|
||||
def on_change_with_attribute_set(self, name=None):
|
||||
if self.product and self.product.template:
|
||||
return self.product.template.attribute_set.id
|
||||
|
||||
attributes_name = fields.Function(
|
||||
fields.Char("Attributes Name"),
|
||||
'on_change_with_attributes_name'
|
||||
)
|
||||
|
||||
@fields.depends('product', 'attributes')
|
||||
def on_change_with_attributes_name(self, name=None):
|
||||
|
||||
Reference in New Issue
Block a user