diff --git a/modules/purchase_trade/purchase.py b/modules/purchase_trade/purchase.py index 7b663d3..72798cd 100755 --- a/modules/purchase_trade/purchase.py +++ b/modules/purchase_trade/purchase.py @@ -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' diff --git a/modules/purchase_trade/view/purchase_line_form.xml b/modules/purchase_trade/view/purchase_line_form.xml index 6a0b82a..8ce4c6c 100755 --- a/modules/purchase_trade/view/purchase_line_form.xml +++ b/modules/purchase_trade/view/purchase_line_form.xml @@ -56,7 +56,7 @@ this repository contains the full copyright notices and license terms. --> - + diff --git a/modules/purchase_trade/view/quality_analysis_tree.xml b/modules/purchase_trade/view/quality_analysis_tree.xml index 8901679..4b6f29b 100644 --- a/modules/purchase_trade/view/quality_analysis_tree.xml +++ b/modules/purchase_trade/view/quality_analysis_tree.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file