I have tried to solve this but I can't get the domain to run correctly. I am using Odoo 13
I have 3 models defined in the following way, I tried to make it clear and simplified, sorry if I missed any syntax errors but here are the relevant fields and classes:
class A(models.Model):
_rec_name = 'num'
num = fields.Integer(required=True)
class B(models.Model):
b_a = fields.Many2one('my_module.a', required=True, related='other.o_a')
b_c = fields.Many2one('my_module.c', ondelete='set null')
class C(models.Model):
c_b = fields.One2many('my_module.b', inverse_name='b_c')
c_a = fields.Many2Many('my_module.a', domain = [('num', '=', [('num', 'in', c_b.b_a)] )] )
So, I need c_a to be limited only to a's that can be found in their corresponding b's. Something like
c_a = [b.b_a for b in c_b]
What is the correct way to set this domain? When I use the one I set in the code I get a recursion depth exceeded error. When I use something like that comprehension I get that c_b is not iterable?!?
Thank you for your time.