Help

0

How add items 2 one2many (ODOO 10)

Avatar
Mehdi BOUKAZOULA

Hello everybody, this is my code :

class model1(models.Model):

     _name ='model1'

    name = Char()    

class model2(models.Model):
     _name ='model2'
    name = Char()

class model3(models.Model):

    _name ='model2'

    name = Selection( [('value1', 'value2'), ('value2', 'value2')], required=True)  

     listing = One2many(comodel_name='model1', inverse_name='name')

     @api.onchange('name')

     def name_ongange(self):

         if self.name == 'value1'

             #I want to add all model1 records

         if self.name == 'value2'
             #I want to add all model2 records


If any one can tell me the solution of my code?? thank you

Avatar
Discard