How to do an INNER / LEFT / RIGHT JOIN at domain field in the API

Hi everybody !
Today I have a new question, I’m trying to do the following query at domain field

SELECT  *
FROM model_a
INNER /LEFT/ RIGHT JOIN model_b
ON model_a.field_equivalent = model_b.field_equivalent

What is it the best way to represent that query?
Thanks for your answers !

On model_b you should add the field:

model_a = fields.Many2One('model_a', "Model A", 
     domain=[('field_equivalent', '=', Eval('field_equivalent')])

Hope it helps.

1 Like

Domain on Many2One are always LEFT JOIN. RIGHT JOIN will be impossible for an ORM. For INNER JOIN it is most of the time the same as LEFT JOIN depending on the operator.

1 Like