跳至內容
選單
此問題已被標幟
1 回覆
4996 瀏覽次數

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?


頭像
捨棄
最佳答案

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
8月 16
4407
1
3月 16
5981
2
2月 25
5971
1
12月 24
1495
0
4月 24
1883