orm - How to add multiple values to Many2many field in One2many field ?Odoo 10 -


i trying add one2many field create method , field has many2many field need fill, there can multiple values..

the color_selector many2many field, data of field color.true(1, 5) or color.true(5)

location_env.sudo().create({'loc_id': loc_id.id,                                     'loc_name': loc_id.loc_name,                                     'purchase_order_line_id': line_id.id,                                     'color_selector': (6, 0, colors_ids)}) 

i have tried :

'color_selector': (6, 0, colors_ids) 'color_selector': [(6, 0, colors_ids)] 'color_selector': (6, 0, [colors_ids]) c_ids = (4, colors) 'color_selector': (6, 0, c_ids) 

to create one2many record in odoo should way.

loc_id.your_one_two_many_field = [(0,0,                                      {'loc_name': loc_id.loc_name,                                       'purchase_order_line_id': line_id.id,                                       'color_selector': [(6, 0, colors_ids)]}                                  )] 

is colors_ids variable list? or recordset?

it has list of record ids. example [1,2,3,4,5].

if colors_ids variable recordset try following

color_selector: [(6, 0, colors_ids.ids)] 

hopefully work you.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -