I want to fetch field value from one2many field and return it to field in parent model:
class test_line(models.Model)
_name='test.line'
name = fields.Char('name')
test_id = fields.Char('Test')
t = fields.Char('T')
class test_parent(models.Model):
test_line_id = fields.One2many('test.line','test_id')
name = fields.Char('name')
** How to return field name in Class test.line to field name in Class test_parent
How i can to solve this Please Help
Thanks
first learn how to correctly do an inverse relation. You also are missing the _name for your parrent model test_id = fields.Many2one('_name value').
Go and learn the basics about relations and models.
def get_name(self):
return self.test_id.name
If you want as a field you can use a relation field. Go read the official documentation and start doing the examples.