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

fields.selection and name_get

By
panmarcin
on 7/25/13, 8:34 AM 1,014 views

Hi everyone, I have some problem in use fuknction name_get where i have fields. selection.

I have this:

class produkt_rodzaj(osv.osv):
    _name="produkt.rodzaj"
    _columns= {
        'name': fields.selection([('1','Carlsberg'),('2','Heineken'),('3','Miller')], 'Nazwa', required=True),
        'wielkosc': fields.selection([('1','Male'),('2','Duze')], 'Wielkosc', required=True),
        'rodzaj': fields.selection([('1','Bezalkoholowe'),('2', 'Alk. 2%'), ('3','Alk. 5%')],'Rodzaj piwa', required=True),
        'cena': fields.float('Cena', size=12),
                }

and i want display name product like 'Carlsberg'. Now i see only id ;f

my name_get function:

def name_get(self, cr, uid, ids, context=None):
        res = []
        for produkt_obj in self.browse(cr, uid, ids, context=context):
            name = produkt_obj.name.name
            res.append((produkt_obj.id, name))
        return res

Anyone can help me?

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

0 follower(s)

Stats

Asked: 7/25/13, 8:34 AM
Seen: 1014 times
Last updated: 3/16/15, 8:10 AM