Relate with domain of Many2Many

Hi, I want to make a relate from one model to another model. These models are linked through two Many2Many fields. And I would like that when you open a relate from one or more records of one model, only the records linked to these records from which you opened the relate would be shown.

Is that possible?, if it’s, how could I make this. I tried to make a domain with the Many2Many and active_ids in the act_window of the relate, but it throws an error of invalid domain. Thanks beforehand.