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

Hi,

I have a one2many field in the model hr.department:

member_team_ids = fields.One2many('hr.employee', 'hr_department_team', string="Members")

and the inverse relation in the model hr.employee:

hr_department_team = fields.Many2one('hr.department', string="Team Work")

the one2many field has a widget many2many in the view:

<field name="member_team_ids" widget="many2many" nolabel="1"/>


The problem is when Im goint to save the model, it only save 1 or 2 elements.

What do you think the problem is?

 


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

For a many2many widget to work you need to use a many2many field in the python, not a One2many field

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 25
1487
0
thg 8 25
2875
4
thg 7 25
24455
2
thg 1 23
5151
0
thg 7 22
4079