20.03.26
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -56,7 +56,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='taxes']" position="before">
|
||||
<page string="Quality Analysis" col="4" id="qa">
|
||||
<field name="quality_analysis" mode="tree,form" view_ids="purchase_trade.quality_analysis_view_tree,purchase_trade.quality_analysis_view_form"/>
|
||||
<field name="quality_analysis" mode="form,tree" view_ids="purchase_trade.quality_analysis_view_form,purchase_trade.quality_analysis_view_tree"/>
|
||||
</page>
|
||||
<page string="Lots" col="4" id="lots">
|
||||
<field name="lots" mode="tree,form" view_ids="lot.lot_view_tree_sequence,lot.lot_view_form"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<tree editable="1">
|
||||
<field name="reference"/>
|
||||
<field name="date"/>
|
||||
<field name="attributes"/>
|
||||
<field name="attributes_name"/>
|
||||
</tree>
|
||||
Reference in New Issue
Block a user