Odoo Help

0

Filling a one2many inside a one2many in onchange

By
Gustavo
on 7/6/17, 8:36 PM 292 views

Hello!,

Using an on_change method I am trying to send default values to a one2many field using the concept of (0,0, {list values}; even there it works fine but inside that one2many there is also a one2many field to which I must also send values to implement In my code the same concept of (0,0, {list values}, but I did not get success.

Could you help me?.


Attached fragment of my code


def cargar_pool_labs(self):

  labs = []

  pool = self.env['mymodel'].sudo().search([])

  for laboratorio in pool:

    analitos = [(0, 0, {'analito': line.analito, 'resultado': line.resultado , 'resultado2': line.resultado2 , 'unidades': line.unidades , 'laboratorio_id': 104920}) for line in laboratorio.analitos_ids]

   labs.append(

    (0,0,{

     'nombre_examen' : laboratorio.nombre_examen,

     'cups' : laboratorio.cups,

     'laboratorio_id': laboratorio.laboratorio_id,

     'analitos_ids' : analitos

     })

   )

  self.laboratorios_ids = labs


Note: the analitos_ids field is the one2many field that is inside the laboratorios_ids field which is also one2many.


Thanks for help!

0
saud negash
On 8/20/17, 3:05 AM

Hi


Do you find solution for this issue ...


Thanks

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/6/17, 8:36 PM
Seen: 292 times
Last updated: 8/20/17, 3:05 AM