Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to display the name of the attribute in the sale.order.form?

Pascal Tremblay
on 4/20/15, 6:30 PM 972 views

Hello all,

Look here, for each product variants, values in the « attributes » column are displayed with this format « Attribute name : Attribute value ».

But here, in the Description field, we only see the « Attribute value ». But we ALSO want the format « Attribute name : Attribute value ».

For example, in image below, we would want this in the description field : « L510 - Chemise à manches courtes pour femme perso (Couleur du tissu : Bleu Royal) »

Please, ideas?


The name of the attribute is stocked in the model product.attribute. In the field name.

How to display this name in the description above?


It is clear that in the file /home/odoo-test/addons/product/product.py, we have this place that recup the name value in product.attribute.value. How to recup the name in product.attribute also?

variant = ", ".join([v.name for v in product.attribute_value_ids])

name = variant and "%s (%s)" % (product.name, variant) or product.name


Pascal Tremblay

--Pascal Tremblay--
| 5 2 7
Alma, Canada
--Pascal Tremblay--

Pascal Tremblay
On 4/22/15, 3:09 PM

Here is our answer to this problem.

In the file /home/odoo-test/odoo-test/addons/product/product.py, we have to change this code :

        for product in self.browse(cr, SUPERUSER_ID, ids, context=context):

                variant = ", ".join([v.name for v in product.attribute_value_ids])

                name = variant and "%s (%s)" % (product.name, variant) or product.name

For this code :

        for product in self.browse(cr, SUPERUSER_ID, ids, context=context):

                variant = ''

                for item in product.attribute_value_ids:

                    variant += (' - ' + str(item.attribute_id.name) + ' : ' + item.name + ';\n')

                name = variant and "%s :\n%s" % (product.name, variant) or product.name

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 4/20/15, 6:30 PM
Seen: 972 times
Last updated: 7/7/16, 4:57 AM