Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
4951 Vues

Hi, I created a res.label model:

class res_label(osv.osv):

    _name = 'res.label'

    _columns = {

        'label': fields.char('Label'), }


and added to res.partner a label_id field:

class res_partner(osv.Model):

    _inherit = "res.partner"

    _columns = {

         'label_id' : fields.many2one('res.label', 'Label')}


But when I creat a label in res.partner it displays 'res.label,1' instead of "My Label" 

anyone knows what I should do to get it works?


Avatar
Ignorer
Meilleure réponse

Hi,

You have to set the _rec_name for the newly created model, or you have to define the name_get function for the model.

Try this,

class res_label(osv.osv):
_name = 'res.label'
_rec_name = 'label'

By using the name_get function: Use of Name Get Function in Odoo


Thanks

Avatar
Ignorer
Publications associées Réponses Vues Activité
1
août 16
4379
1
mars 16
5935
2
févr. 25
5902
1
déc. 24
1453
0
avr. 24
1842