Hi all,
I’m trying to configure a dynamic domain in Odoo 19 (Studio) where one field should be filtered based on the value of another field on the same record.
Use case
I created a custom model for Contact Groups. On my Offer / Quotation (custom or sale.order), I have:
Offer Contact Group (Many2one → my contact group model)
Customer / Contact (Many2one → res.partner)
What I want:
When creating an offer, after selecting a Contact Group, the Customer dropdown should only show contacts that belong to that same group.
If the customer is changed, it must only be possible to pick another customer within the same group.
What I tried
Someone suggested a domain like:
[('x_contact_group_id', '=', x_offer_group_id)]
So I tried the equivalent in Studio on the Customer field domain, something like:
[('x_studio_contactgroep', '=', x_studio_contactgroep_hoofdproject)]
The problem in Odoo 19
In Odoo 19 Studio, the domain editor seems to treat the right side as plain text instead of evaluating it as a field value.
Result:
Odoo behaves like it’s comparing x_studio_contactgroep.display_name to the literal string "x_studio_contactgroep_hoofdproject" (so it never matches properly)
It only “works” if I literally compare to the text, which is obviously not what I need.
So it’s like Odoo 19 is not interpreting the domain as “use the value of the other field”, but as a constant string.
Question
How do you correctly set a domain in Odoo 19 Studio that depends on another field’s value?
Is there a specific syntax required in Odoo 19 Studio’s domain builder?
Do I need to reference .id somewhere?
Or is this a limitation/bug in Studio domains in v19 and does it require another approach (e.g. server action, computed helper field, onchange, related field, context, etc.)?
Any tips or working examples for Odoo 19 are welcome.
Thanks!