Foreign key (many-to-one) filters

Hi,

I’m looking for a way to restrict a foreign key filed to a subset of the target table. For example, in a Customer field, I want to allow only Partners that have a isCustomer attribute set to true:

<many-to-one name=“customer” ref=“my.package.db.Partner” …only customer partners… title=“Customer”/>

I can’t find this in the docs, but I’m sure I’m missing something…

Could someone point me to the relevant resource?

Thanks
Franck

Hi
You’ve to use the domain clause on the UI
Regards

Hi,

You can have a look here https://docs.axelor.com/adk/5.0/dev-guide/actions/action-view.html#vie-action and a sample can be found in menu.XML of axelor-cm






self.isContact = true AND self.mainPartner.isCustomer = true

U need to specify a jpql clause in a domain node

So if I’m not misunderstanding, this will add a filter in the view, but will not enforce the constraint at the db level.
That might be enough for my use case, but it’s just to be sure.

yes, you’re right.