简体   繁体   中英

Pass context to many2many field

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.

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}">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM