Odoo Help

Welcome!

This community 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.

0

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

By
Robson Murilo
on 11/5/16, 8:22 AM 152 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

0
shameem@aχoncoms
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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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