Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
3568 Visualizações

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?

 


Avatar
Cancelar
Melhor resposta

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

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
set. 25
1488
0
ago. 25
2876
4
jul. 25
24460
2
jan. 23
5156
0
jul. 22
4082