[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)
This commit is contained in:
Christophe Matthieu 2014-11-06 18:44:19 +01:00 committed by Martin Trigaux
parent 6f0b1fef4d
commit 7ffbd5c726
2 changed files with 9 additions and 1 deletions

View File

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

View File

@ -249,7 +249,7 @@
<field string="List of Variants" name="product_variant_count" widget="statinfo" />
</button>
</div>
<field name="attribute_line_ids" widget="one2many_list">
<field name="attribute_line_ids" widget="one2many_list" context="{'show_attribute': False}">
<tree string="Variants" editable="bottom">
<field name="attribute_id"/>
<field name="value_ids" widget="many2many_tags" options="{'no_create_edit': True}" domain="[('attribute_id', '=', attribute_id)]" context="{'default_attribute_id': attribute_id}"/>