Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
4987 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Aug. 16
4405
1
März 16
5972
2
Feb. 25
5958
1
Dez. 24
1492
0
Apr. 24
1877