From 7ffbd5c7269a0e0a8280913860adf3a75677b06b Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 6 Nov 2014 18:44:19 +0100 Subject: [PATCH] [FIX] product: name_get of product.attribute.value name was confusing for bom and product if the value of the attribute is display without the attribute name added key in context to keep the previous behaviour (e.g. in product view where the attribute name is present) --- addons/product/product.py | 8 ++++++++ addons/product/product_view.xml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index 8f4921f3974..7060a4f3992 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -365,6 +365,14 @@ class product_attribute_value(osv.osv): 'price_extra': value, }, context=context) + def name_get(self, cr, uid, ids, context=None): + if context and not context.get('show_attribute', True): + return super(product_attribute_value, self).name_get(cr, uid, ids, context=context) + res = [] + for value in self.browse(cr, uid, ids, context=context): + res.append([value.id, "%s: %s" % (value.attribute_id.name, value.name)]) + return res + _columns = { 'sequence': fields.integer('Sequence', help="Determine the display order"), 'name': fields.char('Value', translate=True, required=True), diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 4eb42e38d3b..02dd5690395 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -249,7 +249,7 @@ - +