Odoo Help

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,406 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
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

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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