Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2876 Lượt xem

Dears I need help to add Many2one field to select the value created from my model, i want to use this value in my second model. but i am unable to get the required result. i get in Many2one field the model name from where i try to getting the value and the numbers like "cus.model,1" instead the value store in this model.

below is my code for both models


class hrext_ins_temp(models.Model):

  __name = 'hrext.insurance'

  ins_comp = fields.Many2one('res.partner', "Insurance Company")

  insurance_policy_life = fields.Char("Group Life Insurance Policy")

  insurance_policy_health = fields.Char("Group Health Insurance Policy")



class hrext_empl_temp(models.Model):

  __name = 'hr.employee'

  __inherit = hr.employee'

  insurance_policy = fields.Many2one('hrext.insurance', "Group Life Insurance Policy")


let me know where i can mistaken the code.


Thank you.

Ảnh đại diện
Huỷ bỏ

Hope this will helps you during customization of your modules: https://www.scoop.it/t/learn-openerp

Tác giả Câu trả lời hay nhất

Thank you for your help dear...it's worked.. :)

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

The issue is that there is no name field or the rec_name for the model.


class HrextInsTemp(models.Model):
__name = 'hrext.insurance'
_rec_name = 'ins_comp'

ins_comp = fields.Many2one('res.partner', "Insurance Company")
insurance_policy_life = fields.Char("Group Life Insurance Policy")



Add rec_name as in the above code and see.


Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
8
thg 11 16
4047
2
thg 2 25
5976
1
thg 12 24
1502
1
thg 11 22
16076
3
thg 8 22
13129