Odoo Help

Welcome!

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.

0

i am created new field brand in product,how can i display the brand name when selecting a product in sales order form

By
veena vasudevan
on 12/3/13, 1:47 AM 1,087 views

i am created new field brand in product,how can i display the brand name when selecting a product in sales order form

0

Acespritech

--Acespritech--
839
| 3 2 6
India
--Acespritech--

Having 8+ years of OpenERP Experience. We are Specialized in OpenERP/CRM Solutions, software development, Web development, E commerce solutions & other open source solutions.


Skype : acespritech

Email : info@acespritech.com

Acespritech
On 12/3/13, 3:08 AM

Hi,

You can achieve this by overwriting name_get method of product.

You just need to inherit the Product class and add below method.

def name_get(self, cr, uid, ids, context=None):
    if not len(ids):
        return []
    res = []
    product_read = self.read(cr, uid, ids, ['name', 'default_code' ,'brand'], context=context)
    for product in product_read:
        name = ''
        if product.get('default_code',False):
            name='['+product.get('default_code')+'] '

        if product.get('brand',False):
            name+='['+product.get('brand')+'] '

        name+=product.get('name',False)
        res.append((product['id'], name))
    return res

Above is just an example, you can customize and add values based on requirements.

Thanks,
www.acespritech.com

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)

Stats

Asked: 12/3/13, 1:47 AM
Seen: 1087 times
Last updated: 3/16/15, 8:10 AM