跳至内容
菜单
此问题已终结
4615 查看

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?

形象
丢弃
相关帖文 回复 查看 活动
3
5月 25
1596
1
4月 25
1211
3
9月 24
14061
2
2月 24
2390
1
7月 23
2645