Odoo Help


How can you make domain filter based on field from another class?

on 7/1/16, 3:37 PM 309 views

So I have this 2 classes.


class Relocation(models.Model):
_name = 'test.plan_relocation'

type = fields.Selection()
price_id = fields.Many2one('test.plan_price',domain="[('type','=',type)]")
relocation_line_ids = fields.One2many('test.plan_relocation_line','relocation_id')

and this

class RelocationLine(models.Model):
_name = 'test.plan_relocation_line'

relocation_id = fields.Many2one('test.plan_relocation')
source_id = fields.Many2one('test.plan_spending_actual',required=True)
available_source = fields.Float(related='source_id.available',default=0,readonly=True)

The thing is I want to filter the "source_id" based on the "price_id" field. How can I achieve that?

I'm using Odoo 8.

Thank you so much for your help.

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 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: 7/1/16, 3:37 PM
Seen: 309 times
Last updated: 7/5/16, 1:29 AM