2
votes

Hi I am trying to pass the value from a Many2many field to a Many2many field using the context attribute in the view.

<field name="vehicules" widget="one2many_list" context="{ 'default_problems':(6,0, problems)}">

default_problems and problems are both Many2many fields, I tried also (1,problems), but in both case only 1 element of the Many2many field is passed from problems to default_problems.

Please some help, I am blocked with this and can't find a solution.

1
Have you debugged into JavaScript or Pythonside (Method BaseModel.default_get()) and looked what values will be set into context? I'm just wondering, because i never tried something like that so far.CZoellner

1 Answers

1
votes

When passing many2many field in context it is evaluated to:

[[6, False, list_of_ids]]

You do not have to use the special commands format. You only have to specify the name of the field:

<field name="vehicules" widget="one2many_list" context="{ 'default_problems': problems}">