Odoo Help


How to get value from one field to another in Odoo?

Robson Murilo
on 11/5/16, 8:22 AM 472 views

I want to pass the value of this field:
Image: https://i.stack.imgur.com/I11St.png

for this field:
Image: https://i.stack.imgur.com/4yGi4.png

Shameem Babu @ iWesabe
On 11/7/16, 12:17 AM

Hi Robson

You make the second field to compute (wiil be readonly automatically , you may know)

def _foo(self):
     # On2many field will have a related Many2one field to parent object, example parent_id
     bar = # Calculate the parent_id
     for i in self.env['model of first field'].search([('parent_id', '=', bar )]):
         # You can get all lines of One2many field of that parent object
         # Find the value
     self.second_field = value to be passed
second_field = fields.Float(compute='_foo')

All the best

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.


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)


Asked: 11/5/16, 8:22 AM
Seen: 472 times
Last updated: 11/7/16, 12:17 AM