This commit is contained in:
2026-03-05 19:25:17 +01:00
parent 915fd17d83
commit 13000f110d
2 changed files with 23 additions and 8 deletions

View File

@@ -13,12 +13,11 @@ this repository contains the full copyright notices and license terms. -->
<label name="product"/>
<field name="product"
view_ids="purchase.product_view_list_purchase_line"/>
<label name="attributes"/>
<field name="attributes"/>
<newline/>
<label name="product_supplier"/>
<field name="product_supplier"/>
<newline/>
<label name="att_desc"/>
<field name="att_desc"/>
<label name="concentration"/>
<field name="concentration"/>
<newline/>
@@ -49,6 +48,10 @@ this repository contains the full copyright notices and license terms. -->
<separator name="description" colspan="4"/>
<field name="description" colspan="4"/>
</page>
<page string="Attributes" id="att">
<label name="attributes"/>
<field name="attributes"/>
</page>
<page string="Taxes" id="taxes">
<field name="taxes" colspan="4"/>
</page>

View File

@@ -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):