Skip to Content
Menu
This question has been flagged
2 Replies
2188 Views

I want to add new values (from "task_line_rider_ids")  to the existing values of  one2many tree, what i did is :

if len(proj_obj.task_line_rider_ids) != 0: 

            just_created = situation_ids and max(situation_ids)

            for record in proj_obj:

                for line in record.task_line_rider_ids:

                    x =  { 'product_id': line.product_id.id,

                                           'quantity': line.quantity,

                                           'um_id': line.um_id.id,

                                           'price_unit': line.price_unit,

                                          'price_subtotal': line.price_subtotal,

                                           'progress': line.progress,

                                           'cumulative_amount_ht': line.cumulative_amount_ht}

                   

                just_created.update({'situation_line': (0, 0, x)})

situation_line is the one2many field into it i want to add the lines of the dict x. but this didint worked.



Avatar
Discard
Best Answer

I don't understand your question, you have the record all ready created and in relation? So why don't you just do 

just_created.situation_line = [(x)]

 

Avatar
Discard
Best Answer

If you logic is correct than I think it should be

just_created.write({'situation_line': (0, 0, x)})

Avatar
Discard